Section: 17.6.3.3 [new.delete.array] Status: CD1 Submitter: John A. Pedretti Opened: 2001-01-10 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [new.delete.array].
View all issues with CD1 status.
Discussion:
The default behavior of operator delete[] described in 18.5.1.2, p12 -
namely that for non-null value of ptr, the operator reclaims storage
allocated by the earlier call to the default operator new[] - is not
correct in all cases. Since the specified operator new[] default
behavior is to call operator new (18.5.1.2, p4, p8), which can be
replaced, along with operator delete, by the user, to implement their
own memory management, the specified default behavior of operator
delete[] must be to call operator delete.
Proposed resolution:
Change 18.5.1.2, p12 from
-12- Default behavior:
- For a null value of
ptr, does nothing.- Any other value of
ptrshall be a value returned earlier by a call to the defaultoperator new[](std::size_t). [Footnote: The value must not have been invalidated by an intervening call tooperator delete[](void*)(16.4.5.9 [res.on.arguments]). --- end footnote] For such a non-null value ofptr, reclaims storage allocated by the earlier call to the defaultoperator new[].
to
-12- Default behavior: Calls
operator delete(ptr) oroperator delete(ptr, std::nothrow)respectively.
and expunge paragraph 13.