| 71 | } |
| 72 | |
| 73 | _LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept { |
| 74 | #if !_LIBCPP_HAS_EXCEPTIONS |
| 75 | # if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION |
| 76 | _LIBCPP_ASSERT_SHIM( |
| 77 | (!std::__is_function_overridden < void*(std::size_t), &operator new>()), |
| 78 | "libc++ was configured with exceptions disabled and `operator new(size_t)` has been overridden, " |
| 79 | "but `operator new(size_t, nothrow_t)` has not been overridden. This is problematic because " |
| 80 | "`operator new(size_t, nothrow_t)` must call `operator new(size_t)`, which will terminate in case " |
| 81 | "it fails to allocate, making it impossible for `operator new(size_t, nothrow_t)` to fulfill its " |
| 82 | "contract (since it should return nullptr upon failure). Please make sure you override " |
| 83 | "`operator new(size_t, nothrow_t)` as well."); |
| 84 | # endif |
| 85 | |
| 86 | return operator_new_impl(size); |
| 87 | #else |
| 88 | void* p = nullptr; |
| 89 | try { |
| 90 | p = ::operator new(size); |
| 91 | } catch (...) { |
| 92 | } |
| 93 | return p; |
| 94 | #endif |
| 95 | } |
| 96 | |
| 97 | _LIBCPP_OVERRIDABLE_FUNCTION(void*, operator new[], (size_t size)) _THROW_BAD_ALLOC { return ::operator new(size); } |
| 98 |
no test coverage detected