2002-10-29 Mark Mitchell <mark@codesourcery.com>
+ PR c++/8287
+ * decl.c (finish_destructor_body): Create the label to jump to
+ when returning from a destructor here.
+ (finish_function_body): Rather than here.
+
* semantics.c (finish_alignof): Call complete_type before calling
c_alignof.
* decl2.c (build_expr_from_tree): Use
{
tree exprstmt;
+ /* Any return from a destructor will end up here; that way all base
+ and member cleanups will be run when the function returns. */
+ add_stmt (build_stmt (LABEL_STMT, dtor_label));
+
/* And perform cleanups for our bases and members. */
perform_base_cleanups ();
finish_function_body (compstmt)
tree compstmt;
{
- if (processing_template_decl)
- /* Do nothing now. */;
- else if (DECL_DESTRUCTOR_P (current_function_decl))
- /* Any return from a destructor will end up here. Put it before the
- cleanups so that an explicit return doesn't duplicate them. */
- add_stmt (build_stmt (LABEL_STMT, dtor_label));
-
- /* Close the block; in a destructor, run the member cleanups. */
+ /* Close the block. */
finish_compound_stmt (0, compstmt);
if (processing_template_decl)
2002-10-29 Mark Mitchell <mark@codesourcery.com>
+ PR c++/8287
+ * g++.dg/init/dtor2.C: New test.
+
* g++.dg/template/alignof1.C: New test.
2002-10-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>