From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1343 invoked by alias); 1 Jun 2004 18:15:59 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 1236 invoked by uid 48); 1 Jun 2004 18:15:52 -0000 Date: Tue, 01 Jun 2004 18:15:00 -0000 Message-ID: <20040601181552.1235.qmail@sourceware.org> From: "bangerth at dealii dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20040601170320.15764.boris@kolpackov.net> References: <20040601170320.15764.boris@kolpackov.net> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/15764] no cleanup if temporary's dtor terminates with an exception X-Bugzilla-Reason: CC X-SW-Source: 2004-06/txt/msg00114.txt.bz2 List-Id: ------- Additional Comments From bangerth at dealii dot org 2004-06-01 18:15 ------- Alright, I shouldn't first reduce and then draw conclusions. The call to f() is the necessary step. Here is a slightly smaller testcase: ------------------ extern "C" void abort (); int counter = 0; struct a { ~a () { throw 1; } }; int f (a const&) { return 1; } struct b { b (...) { ++counter; } ~b () { --counter; } }; int main () { try { b tmp(f (a())); } catch (...) {} if (counter != 0) abort (); } -------------- In b tmp(f(a())); the call to a::a() throws, so f return prematurely, and we shouldn't even start to construct tmp. However, we do, thus incrementing the counter. Then we fail to run the destructor, though. W. -- What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|INVALID | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15764