[gnu.g++.bug] g++ 1.32 incorrectly interprets valid C++ program

schmidt%crimee.ics.uci.edu@PARIS.ICS.UCI.EDU ("Douglas C. Schmidt") (01/03/89)

Hi,

   The following C++ program is incorrectly diagnosed by g++ 1.32:

----------------------------------------
#include <stream.h>

class Y {
public:
   static int i;
};

main ( ) {
   cout << Y::i << "\n";
}
----------------------------------------

Here are the diagnostics:

----------------------------------------
g++ version 1.32.0
 /usr/public/lib/g++/gcc-cpp -+ -v -I/cd/ua/schmidt/include/ -undef
-D__GNU__ -D__GNUG__ -Dsparc -Dsun -Dunix foo.C /tmp/cca15828.cpp
GNU CPP version 1.32
 /usr/public/lib/g++/gcc-c++ /tmp/cca15828.cpp -quiet -dumpbase foo.C
-fstrength-reduce -finline-functions -fmemoize-lookups -fsave-memoized
-fchar-charconst -noreg -version -o /tmp/cca15828.s
GNU C++ version 1.32.0 (sparc) compiled by GNU C version 1.31.
In function main ():

foo.C:9: bad argument 0 for function `ostream::operator << (const char
*)' (type was struct ostream *)

foo.C:9: invalid operands to binary <<
----------------------------------------

if the expression 

Y::i 

is replaced by

int ( Y::i )

the program works fine.  cfront accepts this, however.

Doug