int x = auto

Nick Treleaven nick at geany.org
Wed Mar 22 15:23:05 UTC 2023


On Wednesday, 22 March 2023 at 13:41:44 UTC, Max Samukha wrote:
> On Wednesday, 22 March 2023 at 12:49:23 UTC, Nick Treleaven 
> wrote:
>
>> If the enum type inference DIP was accepted and extended to 
>> all types, you could write:
>>
>> int x = $init;
>
> That wouldn't work for default values that are not members of 
> the parameter type - `auto x = 0, auto x = 
> someUnfortunateStructFactory!()()`, etc. Default values are 
> initializers. Type inference should just work for them.

Of course storage class type inference is still necessary for 
those.


More information about the Digitalmars-d mailing list