www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16976] New: Implicit conversion from ulong to int in


          Issue ID: 16976
           Summary: Implicit conversion from ulong to int in
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/
                OS: All
            Status: NEW
          Severity: trivial
          Priority: P3
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: sprink.noreply 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

Dec 16 2016