This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-11-11


1880. When are parameter objects destroyed?

Section: 7.6.1.3  [expr.call]     Status: CD4     Submitter: Hubert Tong     Date: 2014-02-25

[Adopted at the June, 2016 meeting as part of paper P0135R1.]

According to 7.6.1.3 [expr.call] paragraph 4,

The lifetime of a parameter ends when the function in which it is defined returns. The initialization and destruction of each parameter occurs within the context of the calling function.

This presumably means that the destruction of the parameter object occurs before the end of the full-expression, unlike temporaries. This is not what current implementations do, however. It is not clear that a change to treat parameter objects like temporaries, to match existing practice, would be an improvement, however, as it would result in ABI breakage for implementations that destroy parameters in the called function.

See also issue 1935 for a related question regarding the handling of arguments to a placement allocation function and placement deallocation function.

Notes from the June, 2014 meeting:

WG decided to make it unspecified whether parameter objects are destroyed immediately following the call or at the end of the full-expression to which the call belongs. This approach also resolves issue 1935.