[PATCH] D61165: Fix a crash where a [[no_destroy]] destructor was not emitted in an array
JF Bastien via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 26 09:52:22 PDT 2019
jfb added a comment.
In D61165#1479937 <https://reviews.llvm.org/D61165#1479937>, @rjmccall wrote:
> Are you sure these are the right semantics for `nodestroy`? I think there's a reasonable argument that we should not destroy previous elements of a `nodestroy` array just because an element constructor throws. It's basically academic for true globals because the exception will terminate the process anyway, and even for `thread_local`s and `static` locals (where I believe the exception is theoretically recoverable) it's at least arguable that we should either decline to destroy (possibly causing leaks) or simply call `std::terminate`.
I think `std::terminate` makes the most sense. Getting teardown correctly is always tricky, and I'm willing to bet that teardown caused by an exception in construction of an array is even harder and done wrong.
CHANGES SINCE LAST ACTION
More information about the cfe-commits