https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65290
Bug ID: 65290 Summary: [C++11] operator new(std::size_t, const std::nothrow_t&) should call operator new(std::size_t) Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: kariya_mitsuru at hotmail dot com Created attachment 34930 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34930&action=edit g++ -v Please see the sample code below. ========================== sample code ========================== #include <iostream> #include <new> void* operator new(std::size_t) { throw std::bad_alloc(); } int main() { int* p = new(std::nothrow) int; std::cout << std::boolalpha << (p == nullptr) << std::endl; delete p; } ========================== sample code ========================== ========================== output ========================== false ========================== output ========================== cf. http://melpon.org/wandbox/permlink/LTq0gqETftUEvWK0 The C++11 standard 18.6.1.1[new.delete.single]/p.8 says, Default behavior: Calls operator new(size). If the call returns normally, returns the result of that call. Otherwise, returns a null pointer. This description was changed in C++11(see LWG DR206). cf. http://cplusplus.github.io/LWG/lwg-defects.html#206 So, I think that the sample code above should output ========================== output ========================== true ========================== output ========================== I am not sure whether operator new(std::size_t, const std::nothrow_t&) should call operator new(std::size_t) in C++03 mode.