diff --git a/src/alloc.c b/src/alloc.c index 5a89831a..c0940088 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -803,11 +803,11 @@ static bool mi_try_new_handler(bool nothrow) { if (h==NULL) { _mi_error_message(ENOMEM, "out of memory in 'new'"); if (!nothrow) { -#ifdef __EXCEPTIONS - throw std::bad_alloc(); -#else - abort(); -#endif + #if defined(__GNUC__) && !defined(__EXCEPTIONS) + abort(); + #else + throw std::bad_alloc(); + #endif } return false; }