DIPX: Enum Literals / Implicit Selector Expression

Walter Bright newshound2 at digitalmars.com
Fri Jul 1 18:22:46 UTC 2022


On 7/1/2022 8:42 AM, Steven Schveighoffer wrote:
> Yes, but this is not exactly a case without precedent e.g.:
> 
> ```d
> short[] x = [1, 2, 3]; // short[]
> auto y = [1, 2, 3]; // int[]
> 
> void foo(short[] arr);
> foo([1, 2, 3]); // works
> ```

That's because the initializer, *after* it is evaluated for its type, gets cast 
to the type of the lvalue.


More information about the Digitalmars-d mailing list