Fix error: cannot use 'throw' with exceptions disabled #815, by @sergio-nsk

This commit is contained in:
Daan 2024-03-02 15:47:07 -08:00
parent cc4500a024
commit 944ec1ab8a

View file

@ -908,9 +908,13 @@ static bool mi_try_new_handler(bool nothrow) {
#endif #endif
if (h==NULL) { if (h==NULL) {
_mi_error_message(ENOMEM, "out of memory in 'new'"); _mi_error_message(ENOMEM, "out of memory in 'new'");
#if defined(_CPPUNWIND) || defined(__cpp_exceptions) // exceptions are not always enabled
if (!nothrow) { if (!nothrow) {
throw std::bad_alloc(); throw std::bad_alloc();
} }
#else
MI_UNUSED(nothrow);
#endif
return false; return false;
} }
else { else {