[Bug c++/45082] Static const signed int class member causes undefined symbol.

jakub at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Jul 26 15:32:00 GMT 2010



------- Comment #1 from jakub at gcc dot gnu dot org  2010-07-26 15:32 -------
This is not valid C++.  See [class.static.data]/4:
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 (5.19). In that case, the member can
appear in integral constant expressions within its scope. 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.

Your testcase doesn't have the needed 
const int myclass::BUFF_SIZE;
anywhere.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45082



More information about the Gcc-bugs mailing list