The following sample fails to compile: template<class _Type, int _Val> class Container { static const _Type Value = _Val; };
template<class _Type> class Test { static const uint Value = 2; static const Container<_Type, Value> m_Test; }; template<class _Type> const Container<_Type, Test<_Type>::Value> Test<_Type>::m_Test; The compiler says: Test.cpp:29: error: conflicting declaration 'const Container<_Type, Test<_Type>::Value> Test<_Type>::m_Test' Test.cpp:24: error: 'Test<_Type>::m_Test' has a previous declaration as 'const Container<_Type, 2> Test<_Type>::m_Test' Test.cpp:29: error: declaration of 'const Container<_Type, 2> Test<_Type>::m_Test' outside of class is not definition The problem is the Test<_Type>::Value in the definition - if i replace it with 2 it is working. I tried the sample above with Visual Studio 2005 and Comeau 4.3.3 (Online) and both compile without any error. -- Summary: Compilation fails on definition of a static template class member Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: indiana dot jones at gmx dot at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31044