[libcxx-commits] [libcxxabi] [libcxx] [libc++][NFC] Refactor the core logic of operator new into helper functions (PR #69407)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Nov 29 13:20:57 PST 2023


================
@@ -20,7 +20,7 @@
 // in this shared library, so that they can be overridden by programs
 // that define non-weak copies of the functions.
 
-_LIBCPP_WEAK void* operator new(std::size_t size) _THROW_BAD_ALLOC {
+static void* operator_new_impl(std::size_t size) noexcept {
----------------
azhan92 wrote:

Since the standard requires the following behaviour for the new_handler function: 

>  throw an exception of type bad_alloc or a class derived from bad_alloc;

nh() may throw an exception and cause some issues with the noexcept specification on operator_new_impl. Would you consider a change here to prevent problem? 

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


More information about the libcxx-commits mailing list