aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-12-21 13:28:54 -0500
committerJason Merrill <jason@gcc.gnu.org>2016-12-21 13:28:54 -0500
commit8f0db5664a193a11e1141f003edbff48c29274ca (patch)
treebe8b71a56457f32bdda83c30bc2955346ff4a1cd /gcc
parentd697acca12fb5ace0ed1800c39f4fb2d5adb04e8 (diff)
downloadgcc-8f0db5664a193a11e1141f003edbff48c29274ca.zip
gcc-8f0db5664a193a11e1141f003edbff48c29274ca.tar.gz
gcc-8f0db5664a193a11e1141f003edbff48c29274ca.tar.bz2
PR c++/78749 - friend in anonymous namespace
* decl.c (wrapup_globals_for_namespace): Don't complain about friend pseudo-template instantiations. From-SVN: r243862
Diffstat (limited to 'gcc')
-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 757bcef99..c4c5171 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 e83b542..2954160 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 0000000..94c9025
--- /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;
+}