c++/10827: member function pointer array link problem

giovannibajo@libero.it giovannibajo@libero.it
Fri May 16 22:33:00 GMT 2003


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



More information about the Gcc-bugs mailing list