public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60125] New: defaulted constructor with throwing NSDMI still declared as noexcept
@ 2014-02-09 14:43 harald at gigawatt dot nl
  2014-02-09 14:55 ` [Bug c++/60125] " daniel.kruegler at googlemail dot com
  2015-05-07 18:28 ` [Bug c++/60125] [DR 1351] " jason at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: harald at gigawatt dot nl @ 2014-02-09 14:43 UTC (permalink / raw)
  To: gcc-bugs

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).


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-07 18:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-09 14:43 [Bug c++/60125] New: defaulted constructor with throwing NSDMI still declared as noexcept harald at gigawatt dot nl
2014-02-09 14:55 ` [Bug c++/60125] " daniel.kruegler at googlemail dot com
2015-05-07 18:28 ` [Bug c++/60125] [DR 1351] " jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).