From: Kriang Lerdsuwanakij Date: Fri, 9 May 2003 15:10:28 +0000 (+0000) Subject: PR c++/10555, c++/10576 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=88e98cfeb7a9d048923a59132053082699dec968;p=gcc.git PR c++/10555, c++/10576 PR c++/10555, c++/10576 * pt.c (lookup_template_class): Handle class template with multiple levels of parameters when one of the levels contain errors. * g++.dg/template/memclass1.C: New test. From-SVN: r66634 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b826fff3202..65cc24723c5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2003-05-09 Kriang Lerdsuwanakij + + PR c++/10555, c++/10576 + * pt.c (lookup_template_class): Handle class template with + multiple levels of parameters when one of the levels contain + errors. + 2003-05-08 Jason Merrill * init.c (build_new_1): Don't reuse a TARGET_EXPR in an diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 7cabe5ac660..03548262b68 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -4251,6 +4251,15 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain) tree a = coerce_template_parms (TREE_VALUE (t), arglist, template, complain, /*require_all_args=*/1); + + /* Don't process further if one of the levels fails. */ + if (a == error_mark_node) + { + /* Restore the ARGLIST to its full size. */ + TREE_VEC_LENGTH (arglist) = saved_depth; + POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node); + } + SET_TMPL_ARGS_LEVEL (bound_args, i, a); /* We temporarily reduce the length of the ARGLIST so diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5039b542dbb..bfddd4d7b44 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-05-09 Kriang Lerdsuwanakij + + PR c++/10555, c++/10576 + * g++.dg/template/memclass1.C: New test. + 2003-05-08 DJ Delorie * gcc.c-torture/execute/20020404-1.x: New, skip for 16-bit diff --git a/gcc/testsuite/g++.dg/template/memclass1.C b/gcc/testsuite/g++.dg/template/memclass1.C new file mode 100644 index 00000000000..d4ce9695d2a --- /dev/null +++ b/gcc/testsuite/g++.dg/template/memclass1.C @@ -0,0 +1,18 @@ +// { dg-do compile } + +// Origin: Volker Reichelt + +// PR c++/10555: ICE for member class template when one of the +// template argument levels contains errors. + +template struct A +{ + template struct B; +}; + +template struct C +{ + typedef typename A::template B X; // { dg-error "declared|invalid" } +}; + +C c; // { dg-error "instantiated" }