[Bug c++/20547] undefined reference to "static const" fields of classes

2005-03-19 Thread Hu dot YuehWei at gmail dot com
--- Additional Comments From Hu dot YuehWei at gmail dot com 2005-03-20 07:59 --- so the "... = 3;" initialization statement below is a definition or a declaration? According to the C++ standard, its a definition. Should the compiler allocate a memory space for it? struct T

[Bug c++/20547] undefined reference to "static const" fields of classes

2005-03-19 Thread Hu dot YuehWei at gmail dot com
--- Additional Comments From Hu dot YuehWei at gmail dot com 2005-03-19 18:25 --- I see. But why compiler doesn't also make a temporary variable for the constant defined in a class scope? Such as following codes: struct T { static int const a = 3; }; void fff(int const &a)

[Bug c++/20547] undefined reference to "static const" fields of classes

2005-03-19 Thread Hu dot YuehWei at gmail dot com
--- Additional Comments From Hu dot YuehWei at gmail dot com 2005-03-19 14:15 --- I understand what you mean. But why the following codes works: #include #include struct T { static char const a = 3; }; std::vector ddd; int main() { ddd.push_back(static_cast(T::a

[Bug c++/20547] undefined reference to "static const" fields of classes

2005-03-19 Thread Hu dot YuehWei at gmail dot com
--- Additional Comments From Hu dot YuehWei at gmail dot com 2005-03-19 14:01 --- #include struct T { static char const a = 3; }; void fff(char a) { } std::vector b; int main() { fff(T::a); /* this line of codes is fine. */ b.push_back(T::a); /* however, this line of codes

[Bug c++/20547] undefined reference to "static const" fields of classes

2005-03-19 Thread Hu dot YuehWei at gmail dot com
--- Additional Comments From Hu dot YuehWei at gmail dot com 2005-03-19 13:53 --- But according the standard, 'const static' data members of an intergral type can now be initialized _inside_ their class. In this case, the initialization is _also_ a definition, so _n

[Bug c++/20547] New: undefined reference to "static const" fields of classes

2005-03-18 Thread Hu dot YuehWei at gmail dot com
undefined reference to "static const" fields of classes Product: gcc Version: 3.4.4 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: