re PR c++/40274 (Revision 145566 caused ICE in tsubst, at cp/pt.c:9289)

PR c++/40274
	* error.c (dump_template_parms): Pass all args to
	count_non_default_template_args.
	(count_non_default_template_args): Pull out the inner ones.

From-SVN: r149066
This commit is contained in:
Jason Merrill 2009-06-29 19:15:43 -04:00 committed by Jason Merrill
parent b52b174919
commit 8cc77ebed0
2 changed files with 12 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2009-06-29 Jason Merrill <jason@redhat.com>
PR c++/40274
* error.c (dump_template_parms): Pass all args to
count_non_default_template_args.
(count_non_default_template_args): Pull out the inner ones.
2009-06-26 H.J. Lu <hongjiu.lu@intel.com>
* decl.c (duplicate_decls): Re-indent.

View File

@ -165,7 +165,8 @@ dump_template_argument (tree arg, int flags)
static int
count_non_default_template_args (tree args, tree params)
{
int n = TREE_VEC_LENGTH (args);
tree inner_args = INNERMOST_TEMPLATE_ARGS (args);
int n = TREE_VEC_LENGTH (inner_args);
int last;
if (params == NULL_TREE || !flag_pretty_templates)
@ -184,7 +185,7 @@ count_non_default_template_args (tree args, tree params)
def = tsubst_copy_and_build (def, args, tf_none, NULL_TREE, false, true);
--processing_template_decl;
}
if (!cp_tree_equal (TREE_VEC_ELT (args, last), def))
if (!cp_tree_equal (TREE_VEC_ELT (inner_args, last), def))
break;
}
@ -1443,11 +1444,9 @@ dump_template_parms (tree info, int primary, int flags)
? DECL_INNERMOST_TEMPLATE_PARMS (TI_TEMPLATE (info))
: NULL_TREE);
if (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (args))
args = TREE_VEC_ELT (args, TREE_VEC_LENGTH (args) - 1);
len = count_non_default_template_args (args, params);
args = INNERMOST_TEMPLATE_ARGS (args);
for (ix = 0; ix != len; ix++)
{
tree arg = TREE_VEC_ELT (args, ix);