🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by "Douglas C. Schmidt" Tue, 03 Jan 1989 04:08
g++ 1.32 incorrectly interprets valid C++ program
#1595
Author: "Douglas C. Schmidt"
Date: Tue, 03 Jan 1989 04:08
48 lines
1579 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads