I'm no aaa fan, but perhaps

 

X g(X = auto{5});

 

this would avoid having to repeat X.

 

Or does auto{} have a different proposed meaning than taking the left-hand-side type.

 

In this case

 

X g(auto = X{5});

 

deducting the rhs type for the unnamed parameter


 

-----Ursprüngliche Nachricht-----
Von: Alejandro Colomar via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: Di 16.06.2026 14:14
Betreff: Re: [std-proposals] Direct-list-initialization syntax for default function arguments
Anlage: signature.asc
An: Ungureanu Radu via Std-Proposals <std-proposals@lists.isocpp.org>;
CC: Alejandro Colomar <une+cxx_std-proposals@alejandro-colomar.es>; Ungureanu Radu <radu.ungureanu@socopon.com>;
Hi Ungureanu,

On 2026-06-16T13:08:18+0300, Ungureanu Radu via Std-Proposals wrote:
> You bring up a good point, but I think that this can be solved by making
> it only for named parameters only. For example:
>
> void f(X x{5}); // OK
> void f(X {5});  // Not allowed by the proposed syntax
>
> This would avoid changing the current disambiguation rules for something
> like:
>
> X g(X{5});
>
> which would continue to be parsed as it is today. Otherwise, the
> disambiguation would have to get even more complex and could possibly
> break existing code.

I don't know if this would be ambiguous to a compiler or not.  But it
will most certainly be ambiguous to a human.


Have a lovely day!
Alex

--
<https://www.alejandro-colomar.es>
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals