Title
Reuse of placement arguments in deallocation
Status
cd5
Section
7.6.2.8 [expr.new]
Submitter
Hubert Tong

Created on 2014-06-04.00:00:00 last changed 28 months ago

Messages

Date: 2022-08-19.07:54:33

Additional notes (CWG teleconference 2022-08-12):

This issue is resolved by issues 1880 and 2177. Reusing the parameter objects of the placement-new call for the placement-delete invocation is intentional.

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-11-15.00:00:00

[Resolved by CWG1880 (November, 2014) and CWG2177 (November, 2017).]

The description in 7.6.2.8 [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).

History
Date User Action Args
2022-08-19 07:54:33adminsetmessages: + msg6889
2022-08-19 07:54:33adminsetstatus: review -> cd5
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