🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

g++ error with static consts

#1530
From: "Douglas C. Schmidt"
Date: Sat, 12 Nov 1988 23:49
34 lines
1317 bytes
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.
Technical Details
Message-ID: <8811121550.aa15023@PARIS.ICS.UCI.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!ORION.CF.UCI.EDU!schmidt%blanche.ics.uci.edu

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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