aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>2003-05-09 15:10:28 +0000
committerKriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org>2003-05-09 15:10:28 +0000
commit88e98cfeb7a9d048923a59132053082699dec968 (patch)
tree7c4b464dbf3cf31db6f7fef01ecd4bd3ee71786c /gcc
parentf4e12a7cdbfedee35d32f150a166e347d11121d0 (diff)
downloadgcc-88e98cfeb7a9d048923a59132053082699dec968.zip
gcc-88e98cfeb7a9d048923a59132053082699dec968.tar.gz
gcc-88e98cfeb7a9d048923a59132053082699dec968.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/pt.c9
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/memclass1.C18
4 files changed, 39 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b826fff..65cc247 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2003-05-09 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ 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 <jason@redhat.com>
* 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 7cabe5a..0354826 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 5039b54..bfddd4d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2003-05-09 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/10555, c++/10576
+ * g++.dg/template/memclass1.C: New test.
+
2003-05-08 DJ Delorie <dj@redhat.com>
* 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 0000000..d4ce969
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/memclass1.C
@@ -0,0 +1,18 @@
+// { dg-do compile }
+
+// Origin: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+// PR c++/10555: ICE for member class template when one of the
+// template argument levels contains errors.
+
+template <typename> struct A
+{
+ template <typename> struct B;
+};
+
+template <typename T> struct C
+{
+ typedef typename A<T>::template B<U> X; // { dg-error "declared|invalid" }
+};
+
+C<void> c; // { dg-error "instantiated" }