Example: template <typename T> T const max1(T const a, T const b) { return a < b ? b : a; }
template <typename T> T const & max2(T const & a, T const & b) { return a < b ? b : a; } struct Test { static int const A = 1; }; int main() { #if 0 max1(Test::A, 2); // OK. #else max2(Test::A, 2); // Does not link: undefined reference to `Test::A #endif } The problem does not appear in 2.95.4 The problem does appear in 3.0.4, 3.2.3 Also appeared on 3.4.4 x86_64 -- Summary: No proper linkage created for in class initialized static const Product: gcc Version: 3.3.5 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dopheide at fmf dot nl CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i486-linux GCC host triplet: i486-linux GCC target triplet: i486-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20484