Fixes for P0127R2 implementation.
* pt.c (convert_template_argument): Pass args to do_auto_deduction. (mark_template_parm): Handle deducibility from type of non-type argument here. (for_each_template_parm_r): Not here. From-SVN: r243867
This commit is contained in:
parent
35f4cbd448
commit
a93634ba09
@ -1,5 +1,10 @@
|
||||
2016-12-21 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* pt.c (convert_template_argument): Pass args to do_auto_deduction.
|
||||
(mark_template_parm): Handle deducibility from type of non-type
|
||||
argument here.
|
||||
(for_each_template_parm_r): Not here.
|
||||
|
||||
* ptree.c (cxx_print_type): Print args of
|
||||
BOUND_TEMPLATE_TEMPLATE_PARM.
|
||||
(cxx_print_decl): Print DECL_TEMPLATE_PARMS.
|
||||
|
21
gcc/cp/pt.c
21
gcc/cp/pt.c
@ -4467,6 +4467,15 @@ mark_template_parm (tree t, void* data)
|
||||
tpd->arg_uses_template_parms[tpd->current_arg] = 1;
|
||||
}
|
||||
|
||||
/* In C++17 the type of a non-type argument is a deduced context. */
|
||||
if (cxx_dialect >= cxx1z
|
||||
&& TREE_CODE (t) == TEMPLATE_PARM_INDEX)
|
||||
for_each_template_parm (TREE_TYPE (t),
|
||||
&mark_template_parm,
|
||||
data,
|
||||
NULL,
|
||||
/*include_nondeduced_p=*/false);
|
||||
|
||||
/* Return zero so that for_each_template_parm will continue the
|
||||
traversal of the tree; we want to mark *every* template parm. */
|
||||
return 0;
|
||||
@ -7328,14 +7337,16 @@ convert_template_argument (tree parm,
|
||||
}
|
||||
else
|
||||
{
|
||||
tree t = tsubst (TREE_TYPE (parm), args, complain, in_decl);
|
||||
tree t = TREE_TYPE (parm);
|
||||
|
||||
if (tree a = type_uses_auto (t))
|
||||
{
|
||||
t = do_auto_deduction (t, arg, a, complain, adc_unspecified);
|
||||
t = do_auto_deduction (t, arg, a, complain, adc_unify, args);
|
||||
if (t == error_mark_node)
|
||||
return error_mark_node;
|
||||
}
|
||||
else
|
||||
t = tsubst (t, args, complain, in_decl);
|
||||
|
||||
if (invalid_nontype_parm_type_p (t, complain))
|
||||
return error_mark_node;
|
||||
@ -8956,12 +8967,6 @@ for_each_template_parm_r (tree *tp, int *walk_subtrees, void *d)
|
||||
return t;
|
||||
else if (!fn)
|
||||
return t;
|
||||
|
||||
/* In C++17 we can deduce a type argument from the type of a non-type
|
||||
argument. */
|
||||
if (cxx_dialect >= cxx1z
|
||||
&& TREE_CODE (t) == TEMPLATE_PARM_INDEX)
|
||||
WALK_SUBTREE (TREE_TYPE (t));
|
||||
break;
|
||||
|
||||
case TEMPLATE_DECL:
|
||||
|
Loading…
Reference in New Issue
Block a user