From 5b6dad5d8fbc79a1029f55e565336df4b74ed3c6 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 13 Nov 2009 13:46:47 -0500 Subject: [PATCH] re PR c++/27425 (ICE with invalid template-template-parameter) PR c++/27425 PR c++/34274 * pt.c (expand_template_argument_pack): Handle null arg gracefully. (convert_template_argument): Use %T for type. From-SVN: r154164 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 4 +++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/template/arg7.C | 11 +++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/template/arg7.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 722c98342c1..d5dc053c741 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2009-11-13 Jason Merrill + PR c++/27425 + PR c++/34274 + * pt.c (expand_template_argument_pack): Handle null arg gracefully. + (convert_template_argument): Use %T for type. + PR c++/29363 * decl.c (create_implicit_typedef): Set TYPE_STUB_DECL here. (cxx_init_decl_processing): Not here. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 540f5776c25..b7d72c1045a 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -3150,6 +3150,8 @@ expand_template_argument_pack (tree args) for (in_arg = 0; in_arg < nargs; ++in_arg) { tree arg = TREE_VEC_ELT (args, in_arg); + if (arg == NULL_TREE) + return args; if (ARGUMENT_PACK_P (arg)) { int num_packed = TREE_VEC_LENGTH (ARGUMENT_PACK_ARGS (arg)); @@ -5472,7 +5474,7 @@ convert_template_argument (tree parm, error ("type/value mismatch at argument %d in " "template parameter list for %qD", i + 1, in_decl); - error (" expected a template of type %qD, got %qD", + error (" expected a template of type %qD, got %qT", parm, orig_arg); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 91490670e6e..e26d7052aae 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2009-11-13 Jason Merrill + PR c++/27425 + PR c++/34274 + * g++.dg/template/arg7.C: New. + PR c++/29363 * g++.dg/template/error43.C: New. diff --git a/gcc/testsuite/g++.dg/template/arg7.C b/gcc/testsuite/g++.dg/template/arg7.C new file mode 100644 index 00000000000..a9333b26a21 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/arg7.C @@ -0,0 +1,11 @@ +// PR c++/27425, 34274 + +template struct A +{ + template class> struct B {}; // { dg-error "void|mismatch|expected" } + // { dg-bogus "not supported" "" { target *-*-* } 5 } + template struct C; // { dg-error "void" } + B b; +}; + +A a; // { dg-message "instantiated" }