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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID
      Known to fail|                            |

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
C++03 [expr.delete] p2:

> In either alternative, if the value of the operand of delete is the null
> pointer the operation has no effect.

That wording was changed by
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#348

C++11 [expr.delete] p7:

> If the value of the operand of the delete-expression is not a null pointer
> value, the delete-expression will call a deallocation function (3.7.4.2).
> Otherwise, it is unspecified whether the deallocation function will be
> called.

So in C++03 the delete expressions "have no effect" but that was clarified to
mean that the deallocation functions might not be called, which makes GCC's
behaviour correct.

Prior to r259772 ("PR c++/61982 - dead stores to destroyed objects") GCC was
inconsistent, calling the operator for "delete[] p" but not "delete[] p". Now
it matches Clang's behaviour and neither calls the operator when p is null.

I don't think there's any bug here anyway.

Reply via email to