[llvm-bugs] [Bug 36508] MSVC: noexcept aborts with longjmp

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Sep 1 02:03:54 PDT 2019


Gonzalo BG <gonzalobg88 at gmail.com> changed:

           What    |Removed                     |Added
         Resolution|WONTFIX                     |---
             Status|RESOLVED                    |REOPENED

--- Comment #2 from Gonzalo BG <gonzalobg88 at gmail.com> ---
If the C++ standard wants to allow longjmp to throw a C++ exception, it should
have said so, e.g., here: http://eel.is/c++draft/csetjmp.syn#2 , but it
doesn't, and since C longjmp cannot throw a C++ exception in C, neither can its
counterpart version (arguably, longjmp should be noexcept in C++). 

The windows documentation mentions the interaction between noexcept and
longjmp, e.g., here:
, but instead of saying that it should terminate the process, it explains that
this works, and goes one step further and makes some undefined behavior defined
on the target: jumping over destructors with longjmp is UB, but on MSVC,
apparently, this is defined to actually call destructors except if the function
is noexcept, in which case destructors might or might not be called.  

So AFAICT, MSVC, GCC, and Clang, never call `std::terminate` when a longjmp
happens inside a noexcept function, with the exception of Clang on Windows

This definitely looks like both a C++ standard compliance and a platform bug. 

Since the link to the explanation is down, and no explanation is contained
here, can somebody explain why this isn't a clang bug on windows ?

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190901/419c9f1c/attachment.html>

More information about the llvm-bugs mailing list