From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17491 invoked by alias); 28 Nov 2013 12:15:05 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 17403 invoked by uid 48); 28 Nov 2013 12:15:00 -0000 From: "temporal at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/33799] Return value's destructor not executed when a local variable's destructor throws Date: Thu, 28 Nov 2013 12:15:00 -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: temporal at gmail dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jason at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-11/txt/msg02907.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33799 --- Comment #7 from Kenton Varda --- > It's now 2013 so the sensible thing to do is not return by value > if your destructor can throw. That actually sounds like a pretty difficult rule to follow, unless you either ban throwing destructors altogether or ban returning by value altogether. The don't-throw-from-destructors rule is, of course, popular, but not universally agreed upon. I don't think this bug is the right place to debate it (maybe try http://goo.gl/haB5nm), but I would hope that GCC wouldn't refuse to fix a bug simply because they disagree with the coding style that triggers that bug. > FWIW Clang also behaves the same as G++ and Intel, Yes, I noticed, and Clang has also had a bug filed against them which has languished for years. Nevertheless, the behavior is wrong. > and of course calls std::terminate() in C++11 mode. Unless the destructor has noexcept(false).