On Mon, 2 May 2022 at 20:29, Thiago Macieira via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
On Monday, 2 May 2022 12:15:00 PDT Lénárd Szolnoki via Std-Proposals wrote:
> I'm pretty sure in MSVC parameters are destroyed by the callee. I don't
> think that this is non-conforming.
>
> https://godbolt.org/z/9soos71ae

I stand corrected.

You're right, from the language's point of view it makes no difference whether
the destruction happens before the RET instruction or after (that's not
observable in the abstract machine), so long as the ordering of destruction
remains consistent. That is, if the two objects x and y in

  foo(x, y);

are destroyed in the right order, regardless of who does it.

I don't believe there is a "right order". Certainly the order of initialization of (the parameters initialized by) x and y is indeterminate, so I imagine their destruction would be indeterminate as well.

Note that, importantly, in

foo(x, y), z

the order of destruction of x and y relative to the evaluation of z is implementation-defined; they may be destroyed immediately on return or at the end of the full-expression.
 
I was thinking that there could be some side-effects that only the caller
would know about and that it would require that the caller destroy it, but on
second thought I can't think of any.

No, I'm fairly sure this is about access control. (That is, you must be able to destroy a parameter to call a function, even if the ABI is callee-destroy.)