[libcxx-commits] [libcxxabi] [libc++] Fix the behavior of throwing `operator new` under -fno-exceptions (PR #69498)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 18 12:06:50 PDT 2023


ldionne wrote:

This change is extremely tricky but also pretty necessary -- pinging @llvm/libcxx-vendors .

**If you are a vendor and you build the libc++ shared or static library with `-fno-exceptions`, you must take the time to read the commit message + release note and understand the implications of this change.**

This change does not affect users merely building with ``-fno-exceptions`` if `libc++.dylib`/`libc++.a` has been built with exceptions enabled. But it affects anyone who's building `libc++.dylib`/`libc++.a` with exceptions disabled.

The alternative to this patch is to change the Standard to allow `operator new` to return `nullptr` when exceptions are disabled, which is not something that's acknowledged by the Standard. And then this patch would instead turn into a Clang patch that makes it stop assuming that `operator new` doesn't return `nullptr`.

https://github.com/llvm/llvm-project/pull/69498


More information about the libcxx-commits mailing list