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


SomeDude <lovelyd...@mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelyd...@mailmetrash.com


--- Comment #1 from SomeDude <lovelyd...@mailmetrash.com> 2012-05-01 15:08:48 
PDT ---
This simpler case actually fails:

void main() {
    enum int[] array = [2, 1];
    foreach (r; array){
        r *= 10;          // should be rejected
        writeln(array);
    }
    foreach (ref r; array){
        r *= 10;          // should be rejected
        writeln(array);
    }
    assert(array == [20, 10]);
}

Changing enum to immutable gives the following compilation errors:
bug.d(8): Error: variable bug.main.r cannot modify immutable
bug.d(12): Error: variable bug.main.r cannot modify const

But this 

void main() {
    enum int[] array = [2, 1];
    array[0] = 5;
}

is correctly caught by the compiler:
bug.d(7): Error: constant [2,1][0] is not an lvalue

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

Reply via email to