C++ Logo

std-proposals

Advanced search

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

From: Alejandro Colomar <une+cxx_std-proposals_at_[hidden]>
Date: Tue, 16 Jun 2026 14:13:45 +0200
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>

Received on 2026-06-16 12:13:57