Title
Sized deallocation with a trivial destructor
Status
nad
Section
7.6.2.9 [expr.delete]
Submitter
CWG

Created on 2016-03-03.00:00:00 last changed 81 months ago

Messages

Date: 2016-11-15.00:00:00

Rationale (November, 2016):

The adoption of paper P0035R4 has rendered this issue moot.

Date: 2022-11-20.07:54:16

According to 7.6.2.9 [expr.delete] paragraph 10, deletion of an array of a class with both sized and non-sized deallocation functions is not required to call the sized version if the destructor is trivial:

If deallocation 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, 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.

However, if only a sized deallocation function is specified as a class-specific deallocation function, it is not clear how the size argument is to be determined if the class has a trivial destructor.

History
Date User Action Args
2018-02-27 00:00:00adminsetmessages: + msg6006
2018-02-27 00:00:00adminsetstatus: open -> nad
2016-03-03 00:00:00admincreate