aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-10-28 03:36:56 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-10-27 22:36:56 -0500
commit2a2480e1630e8f5cf1fa8462adc1f4d18fdcefbe (patch)
treeec69e5f4f4bfd9e8dd380c0b59682a4490093f6a /gcc
parenta554186cb8acf21a9ebe94fa36319b327842c3ef (diff)
downloadgcc-2a2480e1630e8f5cf1fa8462adc1f4d18fdcefbe.zip
gcc-2a2480e1630e8f5cf1fa8462adc1f4d18fdcefbe.tar.gz
gcc-2a2480e1630e8f5cf1fa8462adc1f4d18fdcefbe.tar.bz2
init.c (build_delete): Reset TYPE_HAS_DESTRUCTOR here.
* init.c (build_delete): Reset TYPE_HAS_DESTRUCTOR here. * decl.c (finish_function): Not here. (start_function): Do set DECL_INITIAL. From-SVN: r23392
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/decl.c9
-rw-r--r--gcc/cp/init.c4
3 files changed, 14 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c1bb904..0c520b5 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 9a7ecc7..a263acd 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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. */
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 3b3ee7f..2438e07 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -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)