Date: Tue, 16 Jun 2026 13:55:17 +0200
Hi Radu,
could you give a bit (more) of motivation:
E.g. comparing a default argument with an initialization/construction instead of with an assignment?
Why it is not meant for or logical for the explicit keyword to be applied here?
Probably those points are clear for those the proposal suggestion is meant for.
But still I think it would help to clearly state.
-----Ursprüngliche Nachricht-----
Von:Radu Ungureanu via Std-Proposals <std-proposals_at_[hidden]>
Gesendet:Di 16.06.2026 00:44
Betreff:[std-proposals] Direct-list-initialization syntax for default function arguments
An:std-proposals_at_[hidden];
CC:Radu Ungureanu <radu.ungureanu_at_[hidden]>;
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.
Thanks,
Radu Ungureanu
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2026-06-16 11:58:55
