Commit b4ba0852 by Nathan Sidwell Committed by Nathan Sidwell

re PR c++/78701 (ICE: unexpected expression N of kind template_parm_index)

	PR c++/78701
	* pt.c (type_unification_real): Check tsubst arg doesn't have
	remaining template parms before converting it.

	PR c++/78701
	* g++.dg/cpp0x/pr78701.C: New.

From-SVN: r243657
parent fa0c02c3
2016-12-14 Nathan Sidwell <nathan@acm.org> 2016-12-14 Nathan Sidwell <nathan@acm.org>
PR c++/78701
* pt.c (type_unification_real): Check tsubst arg doesn't have
remaining template parms before converting it.
PR c++/69481 PR c++/69481
* cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Always use * cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Always use
TYPE_ALIAS_TEMPLATE_INFO for aliases. TYPE_ALIAS_TEMPLATE_INFO for aliases.
......
...@@ -18991,14 +18991,19 @@ type_unification_real (tree tparms, ...@@ -18991,14 +18991,19 @@ type_unification_real (tree tparms,
if (DECL_P (parm)) if (DECL_P (parm))
input_location = DECL_SOURCE_LOCATION (parm); input_location = DECL_SOURCE_LOCATION (parm);
arg = tsubst_template_arg (arg, full_targs, complain, NULL_TREE); arg = tsubst_template_arg (arg, full_targs, complain, NULL_TREE);
arg = convert_template_argument (parm, arg, full_targs, complain, if (!uses_template_parms (arg))
i, NULL_TREE); arg = convert_template_argument (parm, arg, full_targs, complain,
i, NULL_TREE);
else if (saw_undeduced < 2)
arg = NULL_TREE;
else
arg = error_mark_node;
input_location = save_loc; input_location = save_loc;
*checks = get_deferred_access_checks (); *checks = get_deferred_access_checks ();
pop_deferring_access_checks (); pop_deferring_access_checks ();
if (arg == error_mark_node) if (arg == error_mark_node)
return 1; return 1;
else else if (arg)
{ {
TREE_VEC_ELT (targs, i) = arg; TREE_VEC_ELT (targs, i) = arg;
/* The position of the first default template argument, /* The position of the first default template argument,
...@@ -19006,7 +19011,6 @@ type_unification_real (tree tparms, ...@@ -19006,7 +19011,6 @@ type_unification_real (tree tparms,
Record that. */ Record that. */
if (!NON_DEFAULT_TEMPLATE_ARGS_COUNT (targs)) if (!NON_DEFAULT_TEMPLATE_ARGS_COUNT (targs))
SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (targs, i); SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (targs, i);
continue;
} }
} }
......
2016-12-14 Nathan Sidwell <nathan@acm.org>
PR c++/78701
* g++.dg/cpp0x/pr78701.C: New.
2016-12-14 Michael Meissner <meissner@linux.vnet.ibm.com> 2016-12-14 Michael Meissner <meissner@linux.vnet.ibm.com>
* gcc/testsuite/gcc.target/powerpc/vec-extract.h: If DO_TRACE is * gcc/testsuite/gcc.target/powerpc/vec-extract.h: If DO_TRACE is
......
// PR c++/58707
// { dg-do compile { target c++11 } }
// ICE during deduction of default parms
template <class T, T N = T(), bool B = N>
void f(T x) {}
template void f<int> (int);
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