Commit edf1849a by Jason Merrill Committed by Jason Merrill

PR c++/79549 - C++17 ICE with non-type auto template parameter pack

	* pt.c (convert_template_argument): Just return an auto arg pack.
	(tsubst_template_args): Don't tsubst an auto pack type.

From-SVN: r245544
parent b10c7cd7
2017-02-17 Jason Merrill <jason@redhat.com> 2017-02-17 Jason Merrill <jason@redhat.com>
PR c++/79549 - C++17 ICE with non-type auto template parameter pack
* pt.c (convert_template_argument): Just return an auto arg pack.
(tsubst_template_args): Don't tsubst an auto pack type.
PR c++/79556 - C++17 ICE with non-type auto PR c++/79556 - C++17 ICE with non-type auto
* pt.c (do_auto_deduction): Don't try to deduce from null type. * pt.c (do_auto_deduction): Don't try to deduce from null type.
......
...@@ -7612,6 +7612,10 @@ convert_template_argument (tree parm, ...@@ -7612,6 +7612,10 @@ convert_template_argument (tree parm,
if (tree a = type_uses_auto (t)) if (tree a = type_uses_auto (t))
{ {
if (ARGUMENT_PACK_P (orig_arg))
/* There's nothing to check for an auto argument pack. */
return orig_arg;
t = do_auto_deduction (t, arg, a, complain, adc_unify, args); t = do_auto_deduction (t, arg, a, complain, adc_unify, args);
if (t == error_mark_node) if (t == error_mark_node)
return error_mark_node; return error_mark_node;
...@@ -11649,8 +11653,11 @@ tsubst_template_args (tree t, tree args, tsubst_flags_t complain, tree in_decl) ...@@ -11649,8 +11653,11 @@ tsubst_template_args (tree t, tree args, tsubst_flags_t complain, tree in_decl)
new_arg = error_mark_node; new_arg = error_mark_node;
if (TREE_CODE (new_arg) == NONTYPE_ARGUMENT_PACK) { if (TREE_CODE (new_arg) == NONTYPE_ARGUMENT_PACK) {
TREE_TYPE (new_arg) = tsubst (TREE_TYPE (orig_arg), args, if (type_uses_auto (TREE_TYPE (orig_arg)))
complain, in_decl); TREE_TYPE (new_arg) = TREE_TYPE (orig_arg);
else
TREE_TYPE (new_arg) = tsubst (TREE_TYPE (orig_arg), args,
complain, in_decl);
TREE_CONSTANT (new_arg) = TREE_CONSTANT (orig_arg); TREE_CONSTANT (new_arg) = TREE_CONSTANT (orig_arg);
if (TREE_TYPE (new_arg) == error_mark_node) if (TREE_TYPE (new_arg) == error_mark_node)
......
// PR c++/79549
// { dg-options -std=c++1z }
template <auto...>
struct meow;
template <auto C>
struct meow<C> { };
meow<1> m;
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