[libcxx-commits] [libcxx] [libcxxabi] [libc++] Fix noexcept behaviour of operator new helper functions (PR #74337)

Hubert Tong via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 5 10:07:51 PST 2023


================
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
----------------
hubert-reinterpretcast wrote:

> You'll see each overload has its own test file. Can you add one test for each such overload? Note that we also have `std::nothrow_t` overloads of `operator new` but I don't think it makes sense to test that the `new_handler` throws `bad_alloc` for those, since the only thing it would do is terminate.

@ldionne @azhan92: If I read the following correctly, testing the `std::nothrow_t` overloads is meaningful (to ensure that the exception is caught by the default implementation):

> 
> Default behavior: Calls operator new(size), or operator new(size, alignment), respectively. If
> the call returns normally, returns the result of that call. Otherwise, returns a null pointer.

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


More information about the libcxx-commits mailing list