🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1595

g++ 1.32 incorrectly interprets valid C++ program

#1595
From: "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
Technical Details
Message-ID: <8901022009.aa11845@PARIS.ICS.UCI.EDU>
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!uunet!tut.cis.ohio-state.edu!PARIS.ICS.UCI.EDU!schmidt%crimee.ics.uci.edu

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!uunet!tut.cis.ohio-state.edu!PARIS.ICS.UCI.EDU!schmidt%crimee.ics.uci.edu
From: schmidt%crimee.ics.uci.edu@PARIS.ICS.UCI.EDU ("Douglas C. Schmidt")
Newsgroups: gnu.g++.bug
Subject: g++ 1.32 incorrectly interprets valid C++ program
Message-ID: <8901022009.aa11845@PARIS.ICS.UCI.EDU>
Date: 3 Jan 89 04:08:29 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 48