Commit a0c0e716 by Ryan Burn Committed by Jason Merrill

re PR c++/68434 ([concepts] function tsubst sets TYPE_CANONICAL before setting a…

re PR c++/68434 ([concepts] function tsubst sets TYPE_CANONICAL before setting a type's PLACEHOLDER_TYPE_CONSTRAINTS)

	PR c++/68434

	* pt.c (tsubst): Set PLACEHOLDER_TYPE_CONSTRAINTS before
	calling canonical_type_parameter.

From-SVN: r230909
parent 75729cff
2015-11-25 Ryan Burn <contact@rnburn.com>
PR c++/68434
* pt.c (tsubst): Set PLACEHOLDER_TYPE_CONSTRAINTS before
calling canonical_type_parameter.
2015-11-25 Jason Merrill <jason@redhat.com>
* lambda.c (maybe_add_lambda_conv_op): Only set
......
......@@ -12977,6 +12977,12 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
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 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
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,
......
// { 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);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment