Reuse of placement arguments in deallocation
Section [expr.new]
Hubert Tong

Created on 2014-06-04.00:00:00 last changed 1 month ago


Date: 2022-07-15.00:00:00

Additional notes (July, 2022):

Issue 1880 permitted the destruction of parameter objects at the end of the full-expression enclosing the function call. Issue 2177 clarified the exceptions to the parameter object reuse.

Date: 2014-11-15.00:00:00

Notes from the November, 2014 meeting:

The resolution for issue 1880 should mostly resolve this issue. The resolution should handle the case in which an object can only be constructed into the parameter object and neither copied nor moved.

Date: 2014-06-04.00:00:00

The description in [expr.new] paragraph 23 regarding calling a deallocation function following an exception during the initialization of an object resulting from a placement new-expression says,

If a placement deallocation function is called, it is passed the same additional arguments as were passed to the placement allocation function, that is, the same arguments as those specified with the new-placement syntax. If the implementation is allowed to make a copy of any argument as part of the call to the allocation function, it is allowed to make a copy (of the same original value) as part of the call to the deallocation function or to reuse the copy made as part of the call to the allocation function. If the copy is elided in one place, it need not be elided in the other.

This seems curious, as it allows reuse of a parameter object that presumably is destroyed immediately upon the return of the allocation function (but see issue 1880 for a question about the timing of such destructions).

Date User Action Args
2022-07-15 12:53:45adminsetmessages: + msg6883
2022-07-15 12:53:45adminsetstatus: drafting -> review
2014-11-24 00:00:00adminsetmessages: + msg5193
2014-11-24 00:00:00adminsetstatus: open -> drafting
2014-06-04 00:00:00admincreate