From 7873d5fbc379c29055f5c67b3e33126bf0bdd214 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 7 Dec 2015 14:34:04 -0500 Subject: [PATCH] =?utf8?q?re=20PR=20c++/68170=20(Declaring=20friend=20temp?= =?utf8?q?late=20class=20template=20in=20C++1z=20produces=20error:=20speci?= =?utf8?q?alization=20of=20=E2=80=98template=20class=20A?= =?utf8?q?=E2=80=99=20must=20appear=20at=20namespace)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit PR c++/68170 * pt.c (maybe_new_partial_specialization): The injected-class-name is not a new partial specialization. From-SVN: r231380 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/pt.c | 4 ++++ gcc/testsuite/g++.dg/template/friend60.C | 13 +++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/friend60.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7381a756278..7c045e3ab26 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2015-12-07 Jason Merrill + 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 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 22dcee281ba..60cc94c2aac 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 00000000000..5ba9ab2f402 --- /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; +}; -- 2.30.2