This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-10-26
[Moved to DR at the November, 2014 meeting.]
The changes from N3778 require use of a sized deallocator for a case like
char *p = new char[32]; void f() { delete [] p; }
That is unimplementable under current ABIs, which do not store the array size for such allocations. It should instead be unspecified or implementation-defined whether the sized form of operator[] is used for a pointer to a type other than a class with a non-trivial destructor or array thereof.
Proposed resolution (February, 2014) [SUPERSEDED]:
Change 7.6.2.9 [expr.delete] paragraph 10 as follows:
If
the type is complete and ifdeallocation function lookup finds both a usual deallocation function with only a pointer parameter and a usual deallocation function with both a pointer parameter and a size parameter, then
- for the first alternative (delete object), if the type of the object to be deleted is complete, and for the second alternative (delete array), if the type of the object to be deleted is a complete class type with a non-trivial destructor, then the selected deallocation function shall be the one with two parameters;
otherwise, it is implementation-defined which deallocation function is selected.
Otherwise, the selected deallocation function shall be the function with one parameter.
Additional note, February, 2014:
It is not clear that this resolution accurately reflects the intent of the issue. In particular, it changes deletion of a pointer to incomplete type from requiring use of the single-parameter version to being implementation-defined. Also, the “type of the object to be deleted” in the array case is always an array type and thus cannot be “a complete class type with a non-trivial destructor.” The issue has consequently been returned to "review" status.
Proposed resolution (June, 2014):
Change 7.6.2.9 [expr.delete] paragraph 10 as follows:
Ifthe type is complete and ifdeallocation function lookup finds both a usual deallocation function with only a pointer parameter and a usual deallocation function with both a pointer parameter and a size parameter,then the selected deallocation function shall be the one with two parameters. Otherwise, the selected deallocation function shall be the function with one parameter.the function to be called is selected as follows:
If the type is complete and if, for the second alternative (delete array) only, the operand is a pointer to a class type with a non-trivial destructor or a (possibly multi-dimensional) array thereof, the function with two parameters is selected.
Otherwise, it is unspecified which of the two deallocation functions is selected.