init.c (build_delete): Reset TYPE_HAS_DESTRUCTOR here.
authorJason Merrill <jason@yorick.cygnus.com>
Wed, 28 Oct 1998 03:36:56 +0000 (03:36 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 28 Oct 1998 03:36:56 +0000 (22:36 -0500)
* init.c (build_delete): Reset TYPE_HAS_DESTRUCTOR here.
* decl.c (finish_function): Not here.
(start_function): Do set DECL_INITIAL.

From-SVN: r23392

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/init.c

index c1bb9044fcd7ef15858fbcca00c0e14511ea2b7b..0c520b5d5c32615cb458c3a9cd2acf14a5ccdac8 100644 (file)
@@ -1,5 +1,9 @@
 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.
+       
        * pt.c (push_template_decl_real): Complain about default template
        args for enclosing classes.
 
index 9a7ecc711c67a1593cb2d50d9d9452ff79860348..a263acd709dd65fee61b90f7490198fcbcfb963b 100644 (file)
@@ -12516,6 +12516,10 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
       && 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
@@ -13074,7 +13078,8 @@ finish_function (lineno, call_poplevel, nested)
             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.  */
+            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.  */
@@ -13133,8 +13138,6 @@ finish_function (lineno, call_poplevel, nested)
                expand_end_cond ();
            }
 
-         TYPE_HAS_DESTRUCTOR (current_class_type) = 1;
-
          virtual_size = c_sizeof (current_class_type);
 
          /* At the end, call delete if that's what's requested.  */
index 3b3ee7f6cc45bd419debf343a115715c0a0e552c..2438e079d4cebb8c220252da78c809aad560da41 100644 (file)
@@ -3079,6 +3079,10 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
       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)