http://d.puremagic.com/issues/show_bug.cgi?id=10685

           Summary: Immutable interval foreach to propagate index value
                    range
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from [email protected] 2013-07-20 13:56:55 PDT ---
Foreach on a defined interval with an immutable index is a very common
operation:


void main() {
    foreach (immutable i; 0 .. 10)
        char c = 'x' + i;
}


DMD 2.064alpha gives:

test.d(3): Error: cannot implicitly convert expression (120 + i) of type int to
char


I suggest to give (propagate) the immutable variable 'i' the range [0, 10] so
the assignment to c requires no cast.

Se also Issue 10018 , Issue 10615 , Issue 10594

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to