Thread View: gnu.g++.bug
1 messages
1 total messages
Started by "Douglas C. Schmidt"
Sat, 12 Nov 1988 23:49
g++ error with static consts
Author: "Douglas C. Schmidt"
Date: Sat, 12 Nov 1988 23:49
Date: Sat, 12 Nov 1988 23:49
34 lines
1317 bytes
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.
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