===================================================================
@@ -12977,6 +12977,12 @@
TYPE_POINTER_TO (r) = NULL_TREE;
TYPE_REFERENCE_TO (r) = NULL_TREE;
+ /* Propagate constraints on placeholders. */
+ if (TREE_CODE (t) == TEMPLATE_TYPE_PARM)
+ if (tree constr = PLACEHOLDER_TYPE_CONSTRAINTS (t))
+ PLACEHOLDER_TYPE_CONSTRAINTS (r)
+ = tsubst_constraint (constr, args, complain, in_decl);
+
if (TREE_CODE (r) == TEMPLATE_TEMPLATE_PARM)
/* We have reduced the level of the template
template parameter, but not the levels of its
@@ -12991,12 +12997,6 @@
else
TYPE_CANONICAL (r) = canonical_type_parameter (r);
- /* Propagate constraints on placeholders. */
- if (TREE_CODE (t) == TEMPLATE_TYPE_PARM)
- if (tree constr = PLACEHOLDER_TYPE_CONSTRAINTS (t))
- PLACEHOLDER_TYPE_CONSTRAINTS (r)
- = tsubst_constraint (constr, args, complain, in_decl);
-
if (code == BOUND_TEMPLATE_TEMPLATE_PARM)
{
tree argvec = tsubst (TYPE_TI_ARGS (t), args,
===================================================================
@@ -0,0 +1,21 @@
+// { dg-options "-std=c++1z" }
+
+template <class>
+concept bool C1 () {
+ return true;
+}
+
+template <class>
+concept bool C2 () {
+ return true;
+}
+
+template <class Expr>
+concept bool C3 () {
+ return requires (Expr expr) {
+ {expr}->C1;
+ {expr}->C2;
+ };
+}
+
+auto f (C3);