C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Parameters with default values at arbitrary positions, with empty arguments

From: Jens Maurer <jens.maurer_at_[hidden]>
Date: Thu, 3 Dec 2026 23:29:52 +0100
On 12/3/26 20:59, Arthur O'Dwyer wrote:
> On Wed, Dec 2, 2026 at 6:50 PM Jens Maurer via Std-Proposals <std-proposals_at_[hidden] <mailto: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?

It does, as far as I know. If the proposal under discussion in this thread
goes anywhere (including being able to reorder), it might be on a trajectory
that would make callee-destroyed function parameter objects non-conforming.

Who knows. Just pointing out. Sorry for the ... panic-inducing choice of words.

> 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?

Not that I'm aware of.

> 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 <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?)
Yes. Again, sorry for increasing the blood pressure here.

Jens

Received on 2026-12-03 22:30:00