[Bug c++/60612] Throwing exception, catching and rethrowing (std::exception_ptr) in destructor leads to segfault

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Mar 21 15:33:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60612

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-03-21
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
In C++11 destructors have an implicit noexcept, so the 4.7 behaviour is wrong:
the program should call std::terminate() when the exception leaves ~A()

If you change the program to:

    ~A() noexcept(false)

then it runs and exits normally.

If you explicitly add:

    ~A() noexcept(true)

then you get the same behaviour from 4.7 and 4.8, it segfaults in the terminate
handler.



More information about the Gcc-bugs mailing list