🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #972

Init of static members inside class def

#972
From: LOPATIN
Date: Thu, 20 Aug 1992 19:34
32 lines
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.
Technical Details
Message-ID: <199208201131.AA19238@inpbox.inp.nsk.su>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!inp.nsk.SU!lopatin

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!inp.nsk.SU!lopatin
From: lopatin@inp.nsk.SU (LOPATIN)
Subject: Init of static members inside class def
Message-ID: <199208201131.AA19238@inpbox.inp.nsk.su>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 20 Aug 1992 19:34:00 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 35