Another needed tweak, applying to trunk.
commit aac24a75af315fb6aa6099a159c6bce339706bc1 Author: Jason Merrill <ja...@redhat.com> Date: Mon Aug 18 21:34:12 2014 -0400
PR lto/53808 PR c++/61659 * decl.c (maybe_commonize_var): Don't use DECL_COMDAT to trigger comdat_linkage. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 92a6dbc..cc54cca 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5099,10 +5099,6 @@ maybe_commonize_var (tree decl) } } } - else if (DECL_LANG_SPECIFIC (decl) && DECL_COMDAT (decl)) - /* Set it up again; we might have set DECL_INITIAL since the last - time. */ - comdat_linkage (decl); } /* Issue an error message if DECL is an uninitialized const variable. */ diff --git a/gcc/testsuite/g++.dg/abi/spec1.C b/gcc/testsuite/g++.dg/abi/spec1.C new file mode 100644 index 0000000..153c0cf --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/spec1.C @@ -0,0 +1,4 @@ +// { dg-final { scan-assembler-not "weak" } } + +template <class T> struct A { static int i; }; +template<> int A<int>::i = 42;