From 7beb0c35aa0ccd44a3e7ff87eab390536ca77051 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sat, 8 Aug 2015 18:01:39 -0400 Subject: [PATCH] =?utf8?q?re=20PR=20c++/67152=20([concepts]=20bogus=20"par?= =?utf8?q?tial=20specialization=20of=20=E2=80=98foo=E2=80=99=20after=20?= =?utf8?q?instantiation"=20error)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit PR c++/67152 * pt.c (process_partial_specialization): Call associate_classtype_constraints. From-SVN: r226739 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/pt.c | 2 ++ gcc/testsuite/g++.dg/concepts/partial-spec6.C | 24 +++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 gcc/testsuite/g++.dg/concepts/partial-spec6.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f04b15c0f62..786ec107846 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2015-08-08 Jason Merrill + PR c++/67152 + * pt.c (process_partial_specialization): Call + associate_classtype_constraints. + PR c++/67159 * constraint.cc (finish_template_introduction): SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index e05d77517ba..ecd86e4397f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -4672,6 +4672,8 @@ process_partial_specialization (tree decl) /* We didn't register this in check_explicit_specialization so we could wait until the constraints were set. */ decl = register_specialization (decl, maintmpl, specargs, false, 0); + else + associate_classtype_constraints (type); DECL_TEMPLATE_SPECIALIZATIONS (maintmpl) = tree_cons (specargs, tmpl, diff --git a/gcc/testsuite/g++.dg/concepts/partial-spec6.C b/gcc/testsuite/g++.dg/concepts/partial-spec6.C new file mode 100644 index 00000000000..2196fcdf3aa --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/partial-spec6.C @@ -0,0 +1,24 @@ +// PR c++/67152 +// { dg-options -std=c++1z } + +template +concept bool HasType = requires { typename T::type; }; + +template +struct trait { + using type = void; +}; + +struct has_type { using type = void; }; + +// Instantiation here +trait::type foo() {} + +// constrained version here. Type "has_type" would fail this +// constraint so this partial specialization would not have been +// selected. +template + requires !HasType +struct trait { + using type = void; +}; -- 2.30.2