Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by LOPATIN
Thu, 20 Aug 1992 19:34
Init of static members inside class def
Author: LOPATIN
Date: Thu, 20 Aug 1992 19:34
Date: Thu, 20 Aug 1992 19:34
32 lines
1088 bytes
1088 bytes
I admire how your gcc 2.1 works on my DECstation 5000/200 (Ultrix 4.2),
but it seems to be erroneous not to reject initialization of the static member
inside class definition. Let me illustrate it by example:
[ 191 > cat one.C
#include <iostream.h>
struct item {
static int y = 1;
};
main(){
item x;
cout << x.y <<"\n";
}
[ 192 > cat two.C
struct item {
static int y;
};
int item::y = 2;
[ 193 > g++ one.C two.C
[ 194 > a.out
2
For those who only red the first edition of Stroustrup's book
it is not obvious that "one.C" is invalid, so it is very suitable to
report error on this, like Borland C++ does.
Sincerely yours, Sergei V.Lopatin.
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