This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/10827: member function pointer array link problem
- From: giovannibajo at libero dot it
- To: andre dot maute at gmx dot de, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org
- Date: 16 May 2003 22:16:24 -0000
- Subject: Re: c++/10827: member function pointer array link problem
- Reply-to: giovannibajo at libero dot it, andre dot maute at gmx dot de, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Synopsis: member function pointer array link problem
State-Changed-From-To: open->closed
State-Changed-By: bajo
State-Changed-When: Fri May 16 22:16:23 2003
State-Changed-Why:
Not a bug. ISO C++ standard mandates that you must always
define static const member variables, even if initialized
at declaration time. Quoting §9.4.2p4: "If a static data
member is of const integral or const enumeration type,
its declaration in the class definition can specify a
constant-initializer which shall be an integral constant
expression. [...] The member shall still be defined in a
namespace scope if it is used in the program and the
namespace scope definition shall not contain an initializer."
This leads us to the second problem of your code: ISO C++
allows in-class initialization only for static const member
of integral or enumeration type. In your case, the member
type is neither integral or enumeration, so the code is
ill-formed. It used to be accepted for a GCC extension
(if you try to compile with -pedantic, you get a warning
about it), but the extension has been removed already in
GCC 3.3. I suggest to update your code to reflect this
(just initialize the member at namescope definition).
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10827