Date: Sun, 22 Feb 2026 22:41:27 +0100
On 22/02/2026 22:33, Chris Blume (ProgramMax) via Std-Proposals wrote:
> As a quality of life benefit, I propose allowing auto type deduction for
> members that are given a default initializer:
> class Foo{ auto bar_ = baz(); };
>
> It would be the same as:
> class Foo{ decltype(baz()) bar_ = baz(); };
>
> When the default initializer is not used, the type is still deduced from it.
>
> I believe this aligns nicely with the rest of the language.
It's not the first time this idea gets floated; see
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3897.html
for a summary about why many people think it's a bad idea.
HTH,
--
Giuseppe D'Angelo
> As a quality of life benefit, I propose allowing auto type deduction for
> members that are given a default initializer:
> class Foo{ auto bar_ = baz(); };
>
> It would be the same as:
> class Foo{ decltype(baz()) bar_ = baz(); };
>
> When the default initializer is not used, the type is still deduced from it.
>
> I believe this aligns nicely with the rest of the language.
It's not the first time this idea gets floated; see
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3897.html
for a summary about why many people think it's a bad idea.
HTH,
--
Giuseppe D'Angelo
Received on 2026-02-22 21:41:30
