Closed
Description
Current implementation of operator new
in libcxx / libcxxabi effectively makes plain new
and nothrow new
to coincide when exceptions are disabled: both will return nullptr. However, there is one important difference: for nothrow new
the constructor is not called when the return value is null. This does not happen for ordinary new
in -fno-exceptions
case making impossible to check the return value as constructor might just segfault. From the user perspective it might be better to stick to one of the following:
- Just call
abort()
. This seems what is currently done for things likestd::__throw_out_of_range
in-fno-except
case - Make
operator new
and nothrowoperator new
to behave identically and do not call constructor
Any thoughts on what might be the better solution?