From 2a2480e1630e8f5cf1fa8462adc1f4d18fdcefbe Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 28 Oct 1998 03:36:56 +0000 Subject: [PATCH] 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 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/decl.c | 9 ++++++--- gcc/cp/init.c | 4 ++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c1bb9044fcd..0c520b5d5c3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 1998-10-28 Jason Merrill + * 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 9a7ecc711c6..a263acd709d 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 3b3ee7f6cc4..2438e079d4c 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) -- 2.30.2