/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Aug 2007 09:06:42 +0000 (09:06 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Aug 2007 09:06:42 +0000 (09:06 +0000)
2007-08-15  Paolo Carlini  <pcarlini@suse.de>

PR c++/33035
* pt.c (push_template_decl_real): Depending on TYPE_P
use either TYPE_CONTEXT or DECL_CONTEXT.

/testsuite
2007-08-15  Paolo Carlini  <pcarlini@suse.de>

PR c++/33035
* g++.dg/template/crash68.C: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127508 138bc75d-0d04-0410-961f-82ee72b054a4

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

index e632aac..892e8a6 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-15  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/33035
+       * pt.c (push_template_decl_real): Depending on TYPE_P
+       use either TYPE_CONTEXT or DECL_CONTEXT.
+
 2007-08-14  Mark Mitchell  <mark@codesourcery.com>
 
        * semantics.c (finish_omp_clauses): Strip a NOP_EXPR if
index 5a0bd71..f414bc3 100644 (file)
@@ -3913,7 +3913,9 @@ push_template_decl_real (tree decl, bool is_friend)
            if (current == decl)
              current = ctx;
            else
-             current = TYPE_CONTEXT (current);
+             current = (TYPE_P (current)
+                        ? TYPE_CONTEXT (current)
+                        : DECL_CONTEXT (current));
          }
     }
 
index 8e531de..eef5e69 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-15  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/33035
+       * g++.dg/template/crash68.C: New.
+
 2007-08-15  Maxim Kuvyrkov  <maxim@codesourcery.com>
  
        * gcc.dg/sibcall-3.c: Remove m68k from XFAIL list.
diff --git a/gcc/testsuite/g++.dg/template/crash68.C b/gcc/testsuite/g++.dg/template/crash68.C
new file mode 100644 (file)
index 0000000..9171f8c
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/33035
+
+template<class A> 
+struct a {
+        template<class B> 
+        struct b {
+                template<class C>
+                void f()
+                {
+                        struct g
+                        {
+                                ~g() {}
+                        };
+                }
+        };
+};