From: Jason Merrill Date: Wed, 30 Jul 2014 21:29:25 +0000 (-0400) Subject: re PR lto/53808 (Undefined symbol when building a library with lto) X-Git-Tag: releases/gcc-5.1.0~5897 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e00f67c6e04054bfcb860f31844a0007d5200d9c;p=thirdparty%2Fgcc.git re PR lto/53808 (Undefined symbol when building a library with lto) PR lto/53808 PR c++/61659 * pt.c (push_template_decl_real): Don't set DECL_COMDAT on friends. From-SVN: r213311 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f01020776200..3d8584358447 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-07-30 Jason Merrill + + PR lto/53808 + PR c++/61659 + * pt.c (push_template_decl_real): Don't set DECL_COMDAT on friends. + 2014-07-30 Paolo Carlini PR c++/57397 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 33a8bf47151b..baabcb1aa5b9 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -5021,6 +5021,7 @@ template arguments to %qD do not match original template %qD", } if (flag_implicit_templates + && !is_friend && VAR_OR_FUNCTION_DECL_P (decl)) /* Set DECL_COMDAT on template instantiations; if we force them to be emitted by explicit instantiation or -frepo, diff --git a/gcc/testsuite/g++.dg/template/friend56.C b/gcc/testsuite/g++.dg/template/friend56.C new file mode 100644 index 000000000000..7dd5d486f864 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/friend56.C @@ -0,0 +1,13 @@ +// Make sure we don't mistakenly mark f as DECL_COMDAT. +// { dg-final { scan-assembler "_Z1fv" } } + +void f(); + +template struct A +{ + friend void f(); +}; + +A a; + +void f() { }