This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: 19980824 bugs in initializing static const members
- To: "Reid M. Pinchback" <reidmp at MIT dot EDU>
- Subject: Re: 19980824 bugs in initializing static const members
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 27 Aug 1998 19:31:51 -0300
- Cc: egcs-bugs at cygnus dot com
- References: <2.2.32.19980826182619.00e9fecc@po9.mit.edu>
Reid M Pinchback <reidmp@MIT.EDU> writes:
> I'm using 19980824 on a alpha-dec-osf4.0d, ran into what appears
> to be some bugs related to the handling of initialization in
> static const data members. Experts on the standard may determine
> some of this to be ok behaviour, even if it evidences itself
> in egcs in less-than-verbose ways.
According to the standard, member variable can only be initialized
inside the class body if it is of const integral or const enumeration
type, and it is initialized with a constant value [class.mem]/4,
[class.static.data]/4
However, even in this case, the data member must be defined outside
the class body [class.static.data]/2. Your code is lacking it, so
whenever you refer to the symbol, a link-time error should occur.
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil