Compiling the following program, with "g++ A.cpp" fails to link with the following error message : /tmp/ccehheUK.o:(.rodata+0x0): undefined reference to `A::x' collect2: ld returned 1 exit status
------------------------ struct A { static const int x = 0; }; const int & i = A::x; int main() {} ------------------------ It can be reproduced with g++ versions ranging from 3.2 to 4.3, on Linux and Darwin. Note that changing one "int" to "unsigned" makes it pass. Is this really expected to fail ? -- Summary: Undefined symbols at link for referenced static const data member Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sylvain dot pion at sophia dot inria dot fr GCC host triplet: i386-redhat-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33161