mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-12 06:08:42 +03:00
Fix error: cannot use 'throw' with exceptions disabled
`mimalloc` should compile even if exceptions are disabled by the MSVC or GCC or Clang command-line options.
This commit is contained in:
parent
4e50d6714d
commit
2f42773cd7
1 changed files with 4 additions and 0 deletions
|
@ -913,9 +913,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)
|
||||||
if (!nothrow) {
|
if (!nothrow) {
|
||||||
throw std::bad_alloc();
|
throw std::bad_alloc();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
(void)nothrow;
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue