This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ Patch] PR 33035


Hi,

as I said in the audit trail, here the issue is that we are using
TYPE_CONTEXT on a function_decl, and that cannot be right. I'm quickly
dealing with the problem by using the same solution used elsewhere, in
pt.c and parser.c. Testing is ok on x86_64-linux.

Is this Ok for mainline?

Paolo.

/////////////////
/cp
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.
Index: testsuite/g++.dg/template/crash68.C
===================================================================
*** testsuite/g++.dg/template/crash68.C	(revision 0)
--- testsuite/g++.dg/template/crash68.C	(revision 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() {}
+                         };
+                 }
+         };
+ };
Index: cp/pt.c
===================================================================
*** cp/pt.c	(revision 127493)
--- cp/pt.c	(working copy)
*************** push_template_decl_real (tree decl, bool
*** 3913,3919 ****
  	    if (current == decl)
  	      current = ctx;
  	    else
! 	      current = TYPE_CONTEXT (current);
  	  }
      }
  
--- 3913,3921 ----
  	    if (current == decl)
  	      current = ctx;
  	    else
! 	      current = (TYPE_P (current)
! 			 ? TYPE_CONTEXT (current)
! 			 : DECL_CONTEXT (current));
  	  }
      }
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]