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 33556


Hi,

I have this tiny fix for this ice-on-invalid. Tested x86_64-linux.

Ok for mainline and 4_2-branch after the release?

Thanks,
Paolo.

///////////////////
/cp
2007-09-26  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33556
	* decl.c (grokfndecl): Consistently return NULL_TREE in
	case of error.

/testsuite
2007-09-26  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33556
	* g++.dg/parse/crash39.C: New.
Index: testsuite/g++.dg/parse/crash39.C
===================================================================
*** testsuite/g++.dg/parse/crash39.C	(revision 0)
--- testsuite/g++.dg/parse/crash39.C	(revision 0)
***************
*** 0 ****
--- 1,10 ----
+ // PR c++/33556
+ 
+ struct Ifoo
+ {
+   virtual ~Ifoo() {}
+ };
+ 
+ class foo : Ifoo {};
+ 
+ foo::~foo() { delete this; } // { dg-error "implicitly-declared" }
Index: cp/decl.c
===================================================================
*** cp/decl.c	(revision 128735)
--- cp/decl.c	(working copy)
*************** grokfndecl (tree ctype,
*** 6534,6540 ****
  	       XXX Isn't this done in start_function, too?  */
  	    revert_static_member_fn (decl);
  	  if (DECL_ARTIFICIAL (old_decl))
! 	    error ("definition of implicitly-declared %qD", old_decl);
  
  	  /* Since we've smashed OLD_DECL to its
  	     DECL_TEMPLATE_RESULT, we must do the same to DECL.  */
--- 6534,6543 ----
  	       XXX Isn't this done in start_function, too?  */
  	    revert_static_member_fn (decl);
  	  if (DECL_ARTIFICIAL (old_decl))
! 	    {
! 	      error ("definition of implicitly-declared %qD", old_decl);
! 	      return NULL_TREE;
! 	    }
  
  	  /* Since we've smashed OLD_DECL to its
  	     DECL_TEMPLATE_RESULT, we must do the same to DECL.  */

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