Discussion Thread: DIP 1039--Static Arrays with Inferred Length--Community Review Round 1

Nick Treleaven nick at geany.org
Mon Jan 11 12:34:24 UTC 2021


On Monday, 11 January 2021 at 12:32:42 UTC, Nick Treleaven wrote:
>> ```
>> int[2] bar() { return [1,2]; }
>> long[$] a6 = bar();  // implicit conversion
>> static assert(is(typeof(a6) == long[2]));
>> ```
>
> Error: cannot implicitly convert expression `bar()` of type 
> `int[2]` to `long[]`

This is the error you get today if you write `long[2]` for the 
type of a6. (It's a bit confusing that `long[]` slice type is 
mentioned in the message).


More information about the Digitalmars-d-announce mailing list