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, the relevant wording is still there in the standard, implying callee-destroy is still conforming:
(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