Date: Mon, 15 Jun 2026 19:15:47 -0400
On Mon, Jun 15, 2026 at 6:43 PM Radu Ungureanu via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Hi all,
>
> I want to propose allowing direct-list-initialization syntax for default
> function arguments.
>
> Currently, if a type X has an explicit constructor:
>
> struct X {
> explicit X(int) {}
> };
>
> a default argument can be specified like this:
>
> void f(X x = X{5}) {}
>
> My proposal would allow the following:
>
> void f(X x{5}) {}
>
> With semantics equivalent to:
>
> void f(X x = X{5}) {}
>
> While I am aware this does not add new expressive power, the motivation
> is to use direct-list-initialization style syntax for default arguments
> without requiring the repetition of the parameter type.
>
> I'd appreciate some feedback on the usefulness of such a feature and any
> issues with the proposed semantics or syntax.
Consider unnamed parameters:
X f(X=X{5});
This is currently ok, but so is:
X g(X{5});
This is not a function, however. With the current disambiguation rules,
expanding default initializers in this way would change it to a function.
>
> Thanks,
> Radu Ungureanu
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
<std-proposals_at_[hidden]> wrote:
>
> Hi all,
>
> I want to propose allowing direct-list-initialization syntax for default
> function arguments.
>
> Currently, if a type X has an explicit constructor:
>
> struct X {
> explicit X(int) {}
> };
>
> a default argument can be specified like this:
>
> void f(X x = X{5}) {}
>
> My proposal would allow the following:
>
> void f(X x{5}) {}
>
> With semantics equivalent to:
>
> void f(X x = X{5}) {}
>
> While I am aware this does not add new expressive power, the motivation
> is to use direct-list-initialization style syntax for default arguments
> without requiring the repetition of the parameter type.
>
> I'd appreciate some feedback on the usefulness of such a feature and any
> issues with the proposed semantics or syntax.
Consider unnamed parameters:
X f(X=X{5});
This is currently ok, but so is:
X g(X{5});
This is not a function, however. With the current disambiguation rules,
expanding default initializers in this way would change it to a function.
>
> Thanks,
> Radu Ungureanu
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2026-06-15 23:17:32
