[Bug c++/99845] gcc8: Overloaded operator new[](size_t, const std::nothrow_t&) is seg faulting when the allocation fails

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Mar 31 12:02:31 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99845

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Alternatively, compile with -fcheck-new to tell the compiler that *all*
operator new overloads can return a null pointer. That means it always checks
for null, even for overloads that are declared as potentially-throwing. This is
probably not what you want to do, you probably just need to use 'noexcept' in
the right places.


More information about the Gcc-bugs mailing list