From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6699 invoked by alias); 9 Feb 2014 14:43:42 -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 6654 invoked by uid 48); 9 Feb 2014 14:43:38 -0000 From: "harald at gigawatt dot nl" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60125] New: defaulted constructor with throwing NSDMI still declared as noexcept Date: Sun, 09 Feb 2014 14:43:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: harald at gigawatt dot nl X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: 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: 2014-02/txt/msg00880.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60125 Bug ID: 60125 Summary: defaulted constructor with throwing NSDMI still declared as noexcept Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: harald at gigawatt dot nl struct S { int i = (throw 0, 0); S() = default; }; int main() { try { S(); } catch(int i) { return i; } } The constructor for S is marked noexcept, and as a result, the exception thrown from i's initialiser cannot be caught, and this program aborts. This seems to be exactly what the standard requires: [except.spec]p14 says that the noexcept specification depends only on the functions invoked by the constructor. However, I'm reporting it anyway at the request of Marc Glisse, who says it's worth reporting even if it's a bug in the standard (http://stackoverflow.com/a/21660078/743382).