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]

(C++) patch for g++.pt/explicit74.C


Applied.  We unset TYPE_HAS_DESTRUCTOR to make build_delete generate code
for a destructor, but we weren't setting it again before calling
sub-destructors, causing trouble for recursive calls.  Not that I can
imagine why that would be useful, mind you.  :)

1998-10-28  Jason Merrill  <jason@yorick.cygnus.com>

	* init.c (build_delete): Reset TYPE_HAS_DESTRUCTOR here.
	* decl.c (finish_function): Not here.
	(start_function): Do set DECL_INITIAL.
	
Index: decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.249
diff -c -p -r1.249 decl.c
*** decl.c	1998/10/27 22:33:35	1.249
--- decl.c	1998/10/28 11:34:00
*************** start_function (declspecs, declarator, a
*** 12516,12521 ****
--- 12516,12525 ----
        && TREE_CODE (TREE_TYPE (fntype)) == VOID_TYPE)
      cp_warning ("`operator=' should return a reference to `*this'");
  
+   /* Make the init_value nonzero so pushdecl knows this is not tentative.
+      error_mark_node is replaced below (in poplevel) with the BLOCK.  */
+   DECL_INITIAL (decl1) = error_mark_node;
+ 
  #ifdef SET_DEFAULT_DECL_ATTRIBUTES
    SET_DEFAULT_DECL_ATTRIBUTES (decl1, attrs);
  #endif
*************** finish_function (lineno, call_poplevel, 
*** 13074,13080 ****
  	     pointer to represent the type of our base class.  */
  
  	  /* This side-effect makes call to `build_delete' generate the
! 	     code we have to have at the end of this destructor.  */
  	  TYPE_HAS_DESTRUCTOR (current_class_type) = 0;
  
  	  /* These are two cases where we cannot delegate deletion.  */
--- 13078,13085 ----
  	     pointer to represent the type of our base class.  */
  
  	  /* This side-effect makes call to `build_delete' generate the
! 	     code we have to have at the end of this destructor.
! 	     `build_delete' will set the flag again.  */
  	  TYPE_HAS_DESTRUCTOR (current_class_type) = 0;
  
  	  /* These are two cases where we cannot delegate deletion.  */
*************** finish_function (lineno, call_poplevel, 
*** 13132,13139 ****
  	      if (cond != integer_one_node)
  		expand_end_cond ();
  	    }
- 
- 	  TYPE_HAS_DESTRUCTOR (current_class_type) = 1;
  
  	  virtual_size = c_sizeof (current_class_type);
  
--- 13137,13142 ----
Index: init.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/init.c,v
retrieving revision 1.73
diff -c -p -r1.73 init.c
*** init.c	1998/10/26 00:48:17	1.73
--- init.c	1998/10/28 11:34:00
*************** build_delete (type, addr, auto_delete, f
*** 3079,3084 ****
--- 3079,3088 ----
        tree parent_auto_delete = auto_delete;
        tree cond;
  
+       /* Set this again before we call anything, as we might get called
+ 	 recursively.  */
+       TYPE_HAS_DESTRUCTOR (type) = 1;
+ 
        /* If we have member delete or vbases, we call delete in
  	 finish_function.  */
        if (auto_delete == integer_zero_node)


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