Path: utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!ORION.CF.UCI.EDU!schmidt%blanche.ics.uci.edu From: schmidt%blanche.ics.uci.edu@ORION.CF.UCI.EDU ("Douglas C. Schmidt") Newsgroups: gnu.g++.bug Subject: g++ error with static consts Message-ID: <8811121550.aa15023@PARIS.ICS.UCI.EDU> Date: 12 Nov 88 23:49:47 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 34 Hi, I believe the following is an erroneous C++ program. AT&T CC 1.2.1 flags the assignment of int a to foobar as an error, but g++ 1.27 is silent ( on sparc, as usual ). ---------------------------------------- class foo { private: static const int foobar = 100; public: foo ( int a ) { foobar = a; // this should be a compile-time error! printf ("foobar = %d\n",foobar); // prints 10, instead of 100! } }; main () { foo bar = 10; } ---------------------------------------- Doug ---------------------------------------- schmidt@bonnie.ics.uci.edu (ARPA) | Per me si va nella cita dolente. | Per me si va nell' etterno dolore. | Per me si va tra la perduta gente. | Lasciate ogni speranza voi ch' entrate.