From: Jason Merrill Date: Wed, 21 Dec 2016 18:28:54 +0000 (-0500) Subject: PR c++/78749 - friend in anonymous namespace X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8f0db5664a193a11e1141f003edbff48c29274ca;p=gcc.git PR c++/78749 - friend in anonymous namespace * decl.c (wrapup_globals_for_namespace): Don't complain about friend pseudo-template instantiations. From-SVN: r243862 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 757bcef99d5..c4c51719374 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-12-21 Jason Merrill + + PR c++/78749 - friend in anonymous namespace + * decl.c (wrapup_globals_for_namespace): Don't complain about friend + pseudo-template instantiations. + 2016-12-16 Richard Biener PR c++/71694 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e83b542d424..295416051b7 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -926,6 +926,7 @@ wrapup_globals_for_namespace (tree name_space, void* data ATTRIBUTE_UNUSED) && DECL_EXTERNAL (decl) && !TREE_PUBLIC (decl) && !DECL_ARTIFICIAL (decl) + && !DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (decl) && !TREE_NO_WARNING (decl)) { warning_at (DECL_SOURCE_LOCATION (decl), diff --git a/gcc/testsuite/g++.dg/warn/Wunused-function3.C b/gcc/testsuite/g++.dg/warn/Wunused-function3.C new file mode 100644 index 00000000000..94c9025a43e --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wunused-function3.C @@ -0,0 +1,11 @@ +// { dg-options -Wunused-function } + +namespace +{ + template struct A + { + friend void f(A) { } + }; + + A a; +}