aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2002-10-30 00:05:36 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2002-10-30 00:05:36 +0000
commit5633b37c1bba472243075b894adb9a83053f4d35 (patch)
tree6f208f2cba1ad94d262e56bc5066244dc0d06596 /gcc/cp
parent7deae97af8e8690f1f2af9a1466f5dd6c0f0afa3 (diff)
downloadgcc-5633b37c1bba472243075b894adb9a83053f4d35.zip
gcc-5633b37c1bba472243075b894adb9a83053f4d35.tar.gz
gcc-5633b37c1bba472243075b894adb9a83053f4d35.tar.bz2
re PR c++/8287 (GCC3.2: Destructor called for non-constructed local object)
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. From-SVN: r58643
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl.c13
2 files changed, 12 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d9e212a8..dba4a0d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+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.
+
2002-10-25 Zack Weinberg <zack@codesourcery.com>
PR c++/7266
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index e3b7b5b..f42c8d3 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)