re PR c++/68683 ([concepts] function satisfy_argument_deduction_constraint modifies...
authorRyan Burn <contact@rnburn.com>
Mon, 7 Dec 2015 21:45:13 +0000 (21:45 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 7 Dec 2015 21:45:13 +0000 (16:45 -0500)
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
gcc/cp/constraint.cc
gcc/testsuite/g++.dg/concepts/pr68683.C [new file with mode: 0644]

index 5232534dfd891b519af8a1bdc15dfcb7b21dc33d..6b007e2aea3700e3c183a791dc9d1e7e8cabb992 100644 (file)
@@ -1,3 +1,10 @@
+2015-12-07  Ryan Burn  <contact@rnburn.com>
+
+       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  <jason@redhat.com>
 
        PR c++/68464
index 89da6ecbf797155ba83024c4db8ac885716a75ba..426d8f3f48b4747678f0b77c8d75dbe5e5b9b316 100644 (file)
@@ -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 (file)
index 0000000..a0d8fcf
--- /dev/null
@@ -0,0 +1,24 @@
+// { dg-options "-std=c++1z" }
+
+template <typename, typename>
+struct is_same {
+  static constexpr bool value = true;
+};
+
+template <typename T, typename U>
+concept bool Same = is_same<T, U>::value;
+
+template <typename T>
+concept bool Integral = requires {
+  { T () } -> Same<typename T::value_type>;
+};
+
+struct A {
+  using value_type = bool;
+};
+
+int main () {
+  Integral<A>;
+  Integral<A>;
+  return 0;
+}