Unexpected foreach lowering

ag0aep6g via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 10 14:14:15 PDT 2016


On 08/10/2016 10:54 PM, Steven Schveighoffer 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.

Related:

https://issues.dlang.org/show_bug.cgi?id=14619


More information about the Digitalmars-d-learn mailing list