From 17c6c56b906d99b45dc5eefa5d39435188235051 Mon Sep 17 00:00:00 2001 From: Ryan Burn Date: Mon, 7 Dec 2015 21:45:13 +0000 Subject: [PATCH] re PR c++/68683 ([concepts] function satisfy_argument_deduction_constraint modifies a type tree node but leaves TYPE_CANONICAL unchanged) PR c++/68683 * constraint.cc (satisfy_argument_deduction_constraint): Set TYPE_CANONICAL to NULL_TREE if PLACEHOLDER_TYPE_CONSTRAINTS are changed. From-SVN: r231385 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/constraint.cc | 3 +++ gcc/testsuite/g++.dg/concepts/pr68683.C | 24 ++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 gcc/testsuite/g++.dg/concepts/pr68683.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5232534dfd8..6b007e2aea3 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 89da6ecbf79..426d8f3f48b 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 00000000000..a0d8fcf46b0 --- /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; +} -- 2.30.2