Commit 2a2480e1 by Jason Merrill Committed by Jason Merrill

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
parent a554186c
1998-10-28 Jason Merrill <jason@yorick.cygnus.com> 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 * pt.c (push_template_decl_real): Complain about default template
args for enclosing classes. args for enclosing classes.
......
...@@ -12516,6 +12516,10 @@ start_function (declspecs, declarator, attrs, pre_parsed_p) ...@@ -12516,6 +12516,10 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
&& TREE_CODE (TREE_TYPE (fntype)) == VOID_TYPE) && TREE_CODE (TREE_TYPE (fntype)) == VOID_TYPE)
cp_warning ("`operator=' should return a reference to `*this'"); 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 #ifdef SET_DEFAULT_DECL_ATTRIBUTES
SET_DEFAULT_DECL_ATTRIBUTES (decl1, attrs); SET_DEFAULT_DECL_ATTRIBUTES (decl1, attrs);
#endif #endif
...@@ -13074,7 +13078,8 @@ finish_function (lineno, call_poplevel, nested) ...@@ -13074,7 +13078,8 @@ finish_function (lineno, call_poplevel, nested)
pointer to represent the type of our base class. */ pointer to represent the type of our base class. */
/* This side-effect makes call to `build_delete' generate the /* 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; TYPE_HAS_DESTRUCTOR (current_class_type) = 0;
/* These are two cases where we cannot delegate deletion. */ /* These are two cases where we cannot delegate deletion. */
...@@ -13133,8 +13138,6 @@ finish_function (lineno, call_poplevel, nested) ...@@ -13133,8 +13138,6 @@ finish_function (lineno, call_poplevel, nested)
expand_end_cond (); expand_end_cond ();
} }
TYPE_HAS_DESTRUCTOR (current_class_type) = 1;
virtual_size = c_sizeof (current_class_type); virtual_size = c_sizeof (current_class_type);
/* At the end, call delete if that's what's requested. */ /* At the end, call delete if that's what's requested. */
......
...@@ -3079,6 +3079,10 @@ build_delete (type, addr, auto_delete, flags, use_global_delete) ...@@ -3079,6 +3079,10 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
tree parent_auto_delete = auto_delete; tree parent_auto_delete = auto_delete;
tree cond; 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 /* If we have member delete or vbases, we call delete in
finish_function. */ finish_function. */
if (auto_delete == integer_zero_node) if (auto_delete == integer_zero_node)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment