schmidt%blanche.ics.uci.edu@ORION.CF.UCI.EDU ("Douglas C. Schmidt") (11/13/88)
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.