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

2010-07-27 Thread redi at gcc dot gnu dot org
--- Comment #6 from redi at gcc dot gnu dot org 2010-07-27 23:54 --- (In reply to comment #5) > Thanks for all the great comments and insight. > > I'm still confused as to why when the BUFF_SIZE was defined as: > static const signed int BUFF_SIZE = 20; > it caused the error, but when

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

2010-07-27 Thread rwitmer at xmission dot com
--- Comment #5 from rwitmer at xmission dot com 2010-07-27 15:27 --- Thanks for all the great comments and insight. I'm still confused as to why when the BUFF_SIZE was defined as: static const signed int BUFF_SIZE = 20; it caused the error, but when it was defined as: static const uns

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

2010-07-26 Thread redi at gcc dot gnu dot org
--- Comment #4 from redi at gcc dot gnu dot org 2010-07-26 16:37 --- (In reply to comment #3) > > If you only want it to be used as an integral constant, don't use it in a > context that requires a variable (e.g. reference binding) e.g. funky((int)myclass::BUFF_SIZE); This means th

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

2010-07-26 Thread redi at gcc dot gnu dot org
--- Comment #3 from redi at gcc dot gnu dot org 2010-07-26 16:32 --- (In reply to comment #2) > The bug/feature may be that re-typing BUFF_SIZE to static const unsigned int > allows the compiler to not report a problem. You're not "re-typing" it, you're providing a definition for a vari

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

2010-07-26 Thread rwitmer at xmission dot com
--- Comment #2 from rwitmer at xmission dot com 2010-07-26 15:59 --- I agree with your assessment. Adding const int myclass::BUFF_SIZE; resolves the issue. The bug/feature may be that re-typing BUFF_SIZE to static const unsigned int allows the compiler to not report a problem. It doe

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

2010-07-26 Thread jakub at gcc dot gnu dot org
--- 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 in