aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c1
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-function3.C11
3 files changed, 18 insertions, 0 deletions
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 <jason@redhat.com>
+
+ 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 <rguenther@suse.de>
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 <class T> struct A
+ {
+ friend void f(A) { }
+ };
+
+ A<int> a;
+}