Compile this with current 4.1 branch (verified with 4.1.2 20060710): % cat one.ii template <typename T> struct One { static const int A; }; template <typename T> const int One<T>::A = 5; int f() { return One<int>::A; } % ./gcc/cc1plus one.ii && gcc -c one.s && nm one.o | c++filt U __gxx_personality_v0 00000000 T f() 00000000 D _ZN3OneIT_E1AE
(strangely enough the name _ZN3OneIT_E1AE can't be demangled, but that's secondary). The important point is that this is a template member, which is not defined as weak or linkonce symbol. This breaks when the template is instantiated in multiple .o files (it occurred while compiling obby). Interestingly it depends on the member being marked "const". Without it the symbols look right: 00000000 V One<int>::A With 4.1.0 this generated no .data objects at all (presumably by optimizing away all references to it, by using the constness), and hence no symbol conflicts, so something changed till 4.1.0. -- Summary: const static members generate .data defs Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: matz at gcc dot gnu dot org GCC host triplet: i386-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28327