From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8AFE0386F025; Mon, 20 Apr 2020 09:24:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8AFE0386F025 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587374656; bh=5bGRHUGsz9+v4HVltCSzWtvixfQs2AV4kDbiO9Eu6aE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZvKkN0A74sOPesUCj/lfnnZ/BhxWHwOcAl/hEd+ePNat3W7idDrbekHSGfvYeBvXv YpuoWk1WE6fndyKCU6IHkGrGSQ4iflYe5utG32EzyLXdaos9qGml5mLGK1yJL5UUrL 0LanXGTbGcWjrdU23ZwCA49IBUn/MQNrnYNYtATQ= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/33799] Return value's destructor not executed when a local variable's destructor throws Date: Mon, 20 Apr 2020 09:24:16 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: REOPENED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jason at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status resolution Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Apr 2020 09:24:16 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D33799 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED |--- --- Comment #15 from Jonathan Wakely --- Reopening. Modified version of g++.dg/eh/return1.C showing the remaining bu= g, in the new i() function: // PR c++/33799 // { dg-do run } extern "C" void abort(); int c, d; #if __cplusplus >=3D 201103L #define THROWS noexcept(false) #else #define THROWS #endif struct X { X(bool throws) : throws_(throws) { ++c; } X(const X& x) : throws_(x.throws_) { ++c; } ~X() THROWS { ++d; if (throws_) { throw 1; } } private: bool throws_; }; X f() { X x(true); return X(false); } X g() { return X(true),X(false); } void h() { #if __cplusplus >=3D 201103L []{ return X(true),X(false); }(); #endif } X i() { try { X x(true); return X(false); } catch(...) {} return X(false); } int main() { try { f(); } catch (...) {} try { g(); } catch (...) {} try { h(); } catch (...) {} try { i(); } catch (...) {} if (c !=3D d) throw; }=