Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!cos.com!patrick From: patrick@cos.com (Patrick Steranka) Newsgroups: gnu.g++.bug Subject: Bug in g++ (Can't define global variable) Message-ID: <8912022010.AA05562@cos.com> Date: 2 Dec 89 20:10:33 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 51 >From uunet!lurch.Stanford.EDU!tiemann Thu Nov 30 14:52:28 1989 >Date: Thu, 30 Nov 89 10:48:10 PST >From: uunet!lurch.stanford.edu!tiemann (Michael Tiemann) >To: patrick@cos.com >Subject: Can you define global variables that are of a type "class" > >Send me the code that causes the error, and tell me what machine you >are using. And yes, you should send GNU C++ bug reports to >bug-g++@prep.ai.mit.edu. Michael, et al., I have found a bug and want to report it. The bug is: "You can't define global variables in C++, but you should be able to." The bug can be reproduced as follows: ============================== File: ex5.cc ============================== #include #include String astring; main(int argc, char* argv[]) { astring = "This is a test"; cout << "astring = " << astring << "\n"; } ============================== File: ex5.cc ============================== This was compiled on a SUN 3/280 running SUN OS 3.5. Here is the output from the compilation: cd /usr.MC68020/zulu/patrick/test/c++/ make -k ex5 g++ -o ex5 -g -v ex5.cc gcc version 1.36.1- (based on GCC 1.36) /usr/local/lib/gnu/gcc/gcc-cpp -+ -v -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 ex5.cc /usr/tmp/cca21637.cpp GNU CPP version 1.36 /usr/local/lib/gnu/gcc/gcc-cc1plus /usr/tmp/cca21637.cpp -quiet -dumpbase ex5.cc -g -version -o /usr/tmp/cca21637.s GNU C++ version 1.36.1 (based on GCC 1.36) (68k, MIT syntax) compiled by GNU C version 1.36. default target switches: -m68020 -mc68020 -m68881 -mbitfield as -mc68020 -o ex5.o /usr/tmp/cca21637.s as: error (/usr/tmp/cca21637.s:568): Invalid operand as: error (/usr/tmp/cca21637.s:595): Invalid operand g++: ex5.o: No such file or directory *** Error code 1 make: Fatal error: Target `ex5' not remade because of errors Compilation exited abnormally with code 1 at Sat Dec 2 15:02:45