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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Keith Halligan from comment #0)
> class MyType {
>   public:
>     void* operator new[](size_t sz, const std::nothrow_t& nt) {

Your bug is here. This need to be noexcept.

Passing std::nothrow_t doesn't tell the compiler that this is a nothrow-new,
only making it noexcept does that. So the compiler assumes this will throw on
failure, and so a non-exceptional return is always non-null.

Reply via email to