[Issue 10685] Immutable interval foreach to propagate index value range

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 25 16:21:37 PDT 2013


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



--- Comment #2 from bearophile_hugs at eml.cc 2013-07-25 16:21:34 PDT ---
Another code example that becomes valid


void main() {
    char[26] arr;
    foreach (immutable i, ref c; arr)
        c = 'a' + i;
}


Currently gives:

test.d(4): Error: cannot implicitly convert expression (97u + i) of type uint
to char

But 'i' should have a static range of [0, 25] so 'a'+i should be in the
acceptable range for a char.

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


More information about the Digitalmars-d-bugs mailing list