From: jason Date: Mon, 7 Dec 2015 21:45:13 +0000 (+0000) Subject: PR c++/68683 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ce5f83b24d4e0620f08e9f9a36d86cfcd2d6495;p=thirdparty%2Fgcc.git PR c++/68683 * constraint.cc (satisfy_argument_deduction_constraint): Set TYPE_CANONICAL to NULL_TREE if PLACEHOLDER_TYPE_CONSTRAINTS are changed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231385 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5232534dfd89..6b007e2aea37 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2015-12-07 Ryan Burn + + PR c++/68683 + * constraint.cc (satisfy_argument_deduction_constraint): Set + TYPE_CANONICAL to NULL_TREE if PLACEHOLDER_TYPE_CONSTRAINTS are + changed. + 2015-12-07 Jason Merrill PR c++/68464 diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc index 89da6ecbf797..426d8f3f48b4 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -1871,11 +1871,14 @@ satisfy_argument_deduction_constraint (tree t, tree args, tree pattern = DEDUCT_CONSTR_PATTERN (t); tree placeholder = DEDUCT_CONSTR_PLACEHOLDER (t); tree constr = PLACEHOLDER_TYPE_CONSTRAINTS (placeholder); + tree type_canonical = TYPE_CANONICAL (placeholder); PLACEHOLDER_TYPE_CONSTRAINTS (placeholder) = tsubst_constraint (constr, args, complain|tf_partial, in_decl); + TYPE_CANONICAL (placeholder) = NULL_TREE; tree type = do_auto_deduction (pattern, init, placeholder, complain, adc_requirement); PLACEHOLDER_TYPE_CONSTRAINTS (placeholder) = constr; + TYPE_CANONICAL (placeholder) = type_canonical; if (type == error_mark_node) return boolean_false_node; diff --git a/gcc/testsuite/g++.dg/concepts/pr68683.C b/gcc/testsuite/g++.dg/concepts/pr68683.C new file mode 100644 index 000000000000..a0d8fcf46b01 --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/pr68683.C @@ -0,0 +1,24 @@ +// { dg-options "-std=c++1z" } + +template +struct is_same { + static constexpr bool value = true; +}; + +template +concept bool Same = is_same::value; + +template +concept bool Integral = requires { + { T () } -> Same; +}; + +struct A { + using value_type = bool; +}; + +int main () { + Integral; + Integral; + return 0; +}