aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2015-12-07 14:34:04 -0500
committerJason Merrill <jason@gcc.gnu.org>2015-12-07 14:34:04 -0500
commit7873d5fbc379c29055f5c67b3e33126bf0bdd214 (patch)
tree9d4700ca03186f74f6ea5fe771fcd422cf346eb4 /gcc
parent122ea31075edcb60b72a3729165e41355ec441e2 (diff)
downloadgcc-7873d5fbc379c29055f5c67b3e33126bf0bdd214.zip
gcc-7873d5fbc379c29055f5c67b3e33126bf0bdd214.tar.gz
gcc-7873d5fbc379c29055f5c67b3e33126bf0bdd214.tar.bz2
re PR c++/68170 (Declaring friend template class template in C++1z produces error: specialization of ‘template<class T> class A’ must appear at namespace)
PR c++/68170 * pt.c (maybe_new_partial_specialization): The injected-class-name is not a new partial specialization. From-SVN: r231380
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/pt.c4
-rw-r--r--gcc/testsuite/g++.dg/template/friend60.C13
3 files changed, 21 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7381a75..7c045e3 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2015-12-07 Jason Merrill <jason@redhat.com>
+ PR c++/68170
+ * pt.c (maybe_new_partial_specialization): The injected-class-name
+ is not a new partial specialization.
+
* Make-lang.in (check-c++1z, check-c++-all): Use GXX_TESTSUITE_STDS.
2015-12-06 Jason Merrill <jason@redhat.com>
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 22dcee2..60cc94c 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -855,6 +855,10 @@ maybe_new_partial_specialization (tree type)
if (!current_template_parms)
return NULL_TREE;
+ // The injected-class-name is not a new partial specialization.
+ if (DECL_SELF_REFERENCE_P (TYPE_NAME (type)))
+ return NULL_TREE;
+
// If the constraints are not the same as those of the primary
// then, we can probably create a new specialization.
tree type_constr = current_template_constraints ();
diff --git a/gcc/testsuite/g++.dg/template/friend60.C b/gcc/testsuite/g++.dg/template/friend60.C
new file mode 100644
index 0000000..5ba9ab2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/friend60.C
@@ -0,0 +1,13 @@
+// PR c++/68170
+
+template< typename T >
+class A
+{
+};
+
+template<>
+class A< void >
+{
+ template< typename X >
+ friend class A;
+};