[Issue 16976] New: Implicit conversion from ulong to int in foreach_reverse

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Dec 16 14:55:12 PST 2016


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

          Issue ID: 16976
           Summary: Implicit conversion from ulong to int in
                    foreach_reverse
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/
                OS: All
            Status: NEW
          Severity: trivial
          Priority: P3
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: sprink.noreply at gmail.com

On a 64-bit system where "length" is ulong, a "foreach" statement allows it to
be implicitly converted to an integer if specified. But the same is not allowed
in foreach_reverse.

foreach(int i, v ; [0, 1, 2])
{
    // ok
}

foreach_reverse(int i, v ; [0, 1, 2])
{
    // error cannot implicitly convert (__r1234.length) of type ulong to int
}

--


More information about the Digitalmars-d-bugs mailing list