https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77943

--- Comment #3 from Mathias Stearn <redbeard0531 at gmail dot com> ---
> Not being a C++ expect, but following spec:
> http://en.cppreference.com/w/cpp/language/noexcept_spec
> 
> "If a search for a matching exception handler leaves a function marked
> noexcept or noexcept(true), std::terminate is called immediately."
> 
> Which is probably what happens in fatal() function

The problem is that it merges the calls to fatal() and notFatal() into a single
call with no branch, so there is no way to only call std::terminate() if the
call to throws() was through fatal(). (In reply to Martin Liška from comment
#2)

PS - I realized I uploaded an old version of the repro that shows the alternate
incorrect behavior of always calling std::terminate even when it should go
through nonFatal(). Sorry about that. If you reverse the branches of the
if/else you'll get the behavior I describe in the initial report.

Reply via email to