Commit 7ed12599 by Jason Merrill Committed by Jason Merrill

PR c++/84770 - ICE with typedef and parameter pack.

	* pt.c (verify_unstripped_args_1): Split out from
	verify_unstripped_args.

From-SVN: r258408
parent 732a431d
2018-03-09 Jason Merrill <jason@redhat.com> 2018-03-09 Jason Merrill <jason@redhat.com>
PR c++/84770 - ICE with typedef and parameter pack.
* pt.c (verify_unstripped_args_1): Split out from
verify_unstripped_args.
PR c++/84785 - ICE with alias template and default targs. PR c++/84785 - ICE with alias template and default targs.
* pt.c (type_unification_real): Set processing_template_decl if * pt.c (type_unification_real): Set processing_template_decl if
saw_undeduced == 1. saw_undeduced == 1.
......
...@@ -1134,12 +1134,8 @@ optimize_specialization_lookup_p (tree tmpl) ...@@ -1134,12 +1134,8 @@ optimize_specialization_lookup_p (tree tmpl)
gone through coerce_template_parms by now. */ gone through coerce_template_parms by now. */
static void static void
verify_unstripped_args (tree args) verify_unstripped_args_1 (tree inner)
{ {
++processing_template_decl;
if (!any_dependent_template_arguments_p (args))
{
tree inner = INNERMOST_TEMPLATE_ARGS (args);
for (int i = 0; i < TREE_VEC_LENGTH (inner); ++i) for (int i = 0; i < TREE_VEC_LENGTH (inner); ++i)
{ {
tree arg = TREE_VEC_ELT (inner, i); tree arg = TREE_VEC_ELT (inner, i);
...@@ -1147,13 +1143,22 @@ verify_unstripped_args (tree args) ...@@ -1147,13 +1143,22 @@ verify_unstripped_args (tree args)
/* OK */; /* OK */;
else if (TYPE_P (arg)) else if (TYPE_P (arg))
gcc_assert (strip_typedefs (arg, NULL) == arg); gcc_assert (strip_typedefs (arg, NULL) == arg);
else if (ARGUMENT_PACK_P (arg))
verify_unstripped_args_1 (ARGUMENT_PACK_ARGS (arg));
else if (strip_typedefs (TREE_TYPE (arg), NULL) != TREE_TYPE (arg)) else if (strip_typedefs (TREE_TYPE (arg), NULL) != TREE_TYPE (arg))
/* Allow typedefs on the type of a non-type argument, since a /* Allow typedefs on the type of a non-type argument, since a
parameter can have them. */; parameter can have them. */;
else else
gcc_assert (strip_typedefs_expr (arg, NULL) == arg); gcc_assert (strip_typedefs_expr (arg, NULL) == arg);
} }
} }
static void
verify_unstripped_args (tree args)
{
++processing_template_decl;
if (!any_dependent_template_arguments_p (args))
verify_unstripped_args_1 (INNERMOST_TEMPLATE_ARGS (args));
--processing_template_decl; --processing_template_decl;
} }
......
// PR c++/84770
// { dg-do compile { target c++11 } }
typedef int T;
template<T&...> struct A {};
int i;
A<i> a;
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