diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-10-30 00:05:36 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-10-30 00:05:36 +0000 |
commit | c47a7ada076aa0c58b6829a63329a25e12a42901 (patch) | |
tree | 6f208f2cba1ad94d262e56bc5066244dc0d06596 /gcc/cp/decl.c | |
parent | d05e701def816d91abd7592dc12191cd00db2f7c (diff) | |
download | gcc-c47a7ada076aa0c58b6829a63329a25e12a42901.tar.gz |
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.
PR c++/8287
* g++.dg/init/dtor2.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@58643 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e3b7b5b773a..f42c8d3fdab 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -14275,6 +14275,10 @@ finish_destructor_body () { 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)); + /* In a virtual destructor, we must call delete. */ if (DECL_VIRTUAL_P (current_function_decl)) { @@ -14347,14 +14351,7 @@ void 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) |