Unexpected foreach lowering
Lodovico Giaretta via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Aug 10 14:00:01 PDT 2016
On Wednesday, 10 August 2016 at 20:54:15 UTC, Steven
Schveighoffer wrote:
> On 8/10/16 2:08 PM, Lodovico Giaretta wrote:
>> [...]
>
> The issue is that it tries using [] on the item to see if it
> defines a range-like thing. Since you don't define opSlice(),
> it automatically goes to the subrange.
>
> This breaks for int[] as well as Array.
>
> If I add opSlice to your code (and return this) it works.
>
> This is definitely a bug, it should try range functions before
> opSlice. Please file.
>
> -Steve
Wow. Thanks. I didn't know the compiler would try opSlice. I will
file it.
More information about the Digitalmars-d-learn
mailing list