From: Jason Merrill Date: Tue, 26 Oct 2010 17:57:30 +0000 (-0400) Subject: pt.c (lookup_template_class): push_tinst_level around call to coerce_template_parms. X-Git-Tag: releases/gcc-4.6.0~3165 X-Git-Url: https://gcc.gnu.org/git/?a=commitdiff_plain;ds=sidebyside;h=701c0df13eb1258e38e1b91a459c9e08d4d42d23;p=gcc.git pt.c (lookup_template_class): push_tinst_level around call to coerce_template_parms. * pt.c (lookup_template_class): push_tinst_level around call to coerce_template_parms. From-SVN: r165974 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e4e6446ed520..1ec3c6395549 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2010-10-26 Jason Merrill + * pt.c (lookup_template_class): push_tinst_level around call to + coerce_template_parms. + * tree.c (stabilize_expr): Handle xvalues properly. * call.c (build_over_call): Use argarray[0] for 'this' argument. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 1de5d5527fda..f150d8f61308 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -6595,13 +6595,17 @@ lookup_template_class (tree d1, arglist = bound_args; } else - arglist - = coerce_template_parms (INNERMOST_TEMPLATE_PARMS (parmlist), - INNERMOST_TEMPLATE_ARGS (arglist), - gen_tmpl, - complain, - /*require_all_args=*/true, - /*use_default_args=*/true); + { + push_tinst_level (templ); + arglist + = coerce_template_parms (INNERMOST_TEMPLATE_PARMS (parmlist), + INNERMOST_TEMPLATE_ARGS (arglist), + gen_tmpl, + complain, + /*require_all_args=*/true, + /*use_default_args=*/true); + pop_tinst_level (); + } if (arglist == error_mark_node) /* We were unable to bind the arguments. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b048d8ce2761..a00180a3d317 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-10-26 Jason Merrill + + * g++.dg/template/arg8.C: Test for helpful diagnostic. + 2010-10-26 Janus Weil PR fortran/42647 diff --git a/gcc/testsuite/g++.dg/template/arg8.C b/gcc/testsuite/g++.dg/template/arg8.C new file mode 100644 index 000000000000..5b3a31cc00b1 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/arg8.C @@ -0,0 +1,12 @@ +// Test for a message indicating what template we're trying to convert +// arguments for. We can't actually test for it directly because it +// doesn't have an associated line number, but we can test for the +// "instantiated from here" message that follows. + +template +struct A { }; + +int i; +A a; // { dg-message "instantiated from here" } +// { dg-error "not a valid template argument" "" { target *-*-* } 10 } +// { dg-error "invalid type in declaration" "" { target *-*-* } 10 }