Date: Thu, 3 Dec 2026 14:59:44 -0500
On Wed, Dec 2, 2026 at 6:50 PM Jens Maurer via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> On 11/29/26 16:37, Alejandro Colomar via Std-Proposals wrote:
> > Compilers disagree on what the following program means:
> >
> > struct {
> > char str[16];
> > } hello = {
> > "hello world",
> > .str[6] = 'W',
> > "ORLD"
> > };
>
> This might be syntactically valid C, but it's not valid C++.
>
> For designated initialization of structs, we don't allow reordering
> of initializers because of C++ destruction order. Do we feel the
> same for function arguments? As long as function parameter objects
> are constructed and destroyed in the caller, it's not a problem,
> but C++ used to allow callee-destroyed function parameter objects.
>
Incidentally, Jens, what do you mean "used to allow"? Doesn't it still?
My understanding was that MSVC *does* callee-destroy all function
parameters, and that we didn't think that made MSVC non-conforming. Did
that change [out from under MSVC] recently?
According to an old blog post of mine
<https://quuxplusone.github.io/blog/2018/11/12/parameter-lifetime-and-trivial-abi/>,
the relevant wording is still there in the standard, implying
callee-destroy is still conforming:
https://eel.is/c++draft/expr.call#7.sentence-10
(Or did you just mean that this hypothetical new feature *would* disallow
callee-destroy, so that it "used to" be allowed in this hypothetical?)
–Arthur
std-proposals_at_[hidden]> wrote:
> On 11/29/26 16:37, Alejandro Colomar via Std-Proposals wrote:
> > Compilers disagree on what the following program means:
> >
> > struct {
> > char str[16];
> > } hello = {
> > "hello world",
> > .str[6] = 'W',
> > "ORLD"
> > };
>
> This might be syntactically valid C, but it's not valid C++.
>
> For designated initialization of structs, we don't allow reordering
> of initializers because of C++ destruction order. Do we feel the
> same for function arguments? As long as function parameter objects
> are constructed and destroyed in the caller, it's not a problem,
> but C++ used to allow callee-destroyed function parameter objects.
>
Incidentally, Jens, what do you mean "used to allow"? Doesn't it still?
My understanding was that MSVC *does* callee-destroy all function
parameters, and that we didn't think that made MSVC non-conforming. Did
that change [out from under MSVC] recently?
According to an old blog post of mine
<https://quuxplusone.github.io/blog/2018/11/12/parameter-lifetime-and-trivial-abi/>,
the relevant wording is still there in the standard, implying
callee-destroy is still conforming:
https://eel.is/c++draft/expr.call#7.sentence-10
(Or did you just mean that this hypothetical new feature *would* disallow
callee-destroy, so that it "used to" be allowed in this hypothetical?)
–Arthur
Received on 2026-12-03 20:00:02
