From: Jason Merrill Date: Sat, 8 Aug 2015 22:01:39 +0000 (-0400) Subject: re PR c++/67152 ([concepts] bogus "partial specialization of ‘foo’ after instantia... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7beb0c35aa0ccd44a3e7ff87eab390536ca77051;p=gcc.git re PR c++/67152 ([concepts] bogus "partial specialization of ‘foo’ after instantiation" error) PR c++/67152 * pt.c (process_partial_specialization): Call associate_classtype_constraints. From-SVN: r226739 --- 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; +};