]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/33959 (ICE in instantiate_class_template, at cp/pt.c:6649)
authorJason Merrill <jason@redhat.com>
Tue, 22 Jan 2008 15:59:57 +0000 (10:59 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 22 Jan 2008 15:59:57 +0000 (10:59 -0500)
        PR c++/33959
        * pt.c (tsubst_aggr_type): Make sure our context is complete.

From-SVN: r131725

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

index 675aca54e272ce498a045144226d84b83fcb41ef..7d02bb5b1e65f324ab31f46833212dc1d65004c8 100644 (file)
@@ -1,3 +1,8 @@
+2008-01-21  Jason Merrill  <jason@redhat.com>
+
+       PR c++/33959
+       * pt.c (tsubst_aggr_type): Make sure our context is complete.
+
 2008-01-02  Volker Reichelt  <reichelt@netcologne.de>
 
        Backport:
index a837ba2076dcec8856c12042674654fde2aebc71..9a6f2fc9cc691050124a34558aa95d2aed75c3e2 100644 (file)
@@ -6325,8 +6325,13 @@ tsubst_aggr_type (tree t,
             up.  */
          context = TYPE_CONTEXT (t);
          if (context)
-           context = tsubst_aggr_type (context, args, complain,
-                                       in_decl, /*entering_scope=*/1);
+           {
+             context = tsubst_aggr_type (context, args, complain,
+                                         in_decl, /*entering_scope=*/1);
+             /* If context is a nested class inside a class template,
+                it may still need to be instantiated (c++/33959).  */
+             complete_type (context);
+           }
 
          /* Then, figure out what arguments are appropriate for the
             type we are trying to find.  For example, given:
diff --git a/gcc/testsuite/g++.dg/template/nested5.C b/gcc/testsuite/g++.dg/template/nested5.C
new file mode 100644 (file)
index 0000000..3850fda
--- /dev/null
@@ -0,0 +1,19 @@
+// PR c++/33959
+
+template <typename T> struct A
+{
+  struct C
+  {
+    template <typename U> struct D {};
+  };
+  template <typename S> static C::D<S> bar (S const &);
+};
+
+struct E {};
+
+int
+main ()
+{
+  E e;
+  A<E>::bar (e);
+}