C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Direct-list-initialization syntax for default function arguments

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Tue, 16 Jun 2026 14:17:15 +0200
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_at_[hidden]> 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_at_[hidden]>; CC:Alejandro Colomar <une+cxx_std-proposals_at_[hidden]>; Ungureanu Radu <radu.ungureanu_at_[hidden]>; 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_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2026-06-16 12:20:52