PR c++/10555, c++/10576
authorKriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
Fri, 9 May 2003 15:10:28 +0000 (15:10 +0000)
committerKriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org>
Fri, 9 May 2003 15:10:28 +0000 (15:10 +0000)
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

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/memclass1.C [new file with mode: 0644]

index b826fff3202f0b87d42528d86876ecea7196b0fd..65cc24723c5389cf9278785ed16196b649809dcb 100644 (file)
@@ -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
index 7cabe5ac6600833869ee8a8629c7c53b7abe03f0..03548262b6845b8dbae15a535746823cac7c5888 100644 (file)
@@ -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
index 5039b542dbb73184b0536477d08713fa6437439d..bfddd4d7b44889eeb4c9abef408bfa087401fddb 100644 (file)
@@ -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 (file)
index 0000000..d4ce969
--- /dev/null
@@ -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" }