immutable ref foreach on values

bearophile bearophileHUGS at lycos.com
Fri Jun 22 04:07:13 PDT 2012


Is this expected and good?


void main() {
     int[] array = [1, 2];
     foreach (ref const(int) x; array) {} // OK
     foreach (ref immutable(int) x; array) {} // error
}


DMD 2.060alpha:
temp.d(4): Error: argument type mismatch, int to ref 
immutable(int)

Thank you,
bye,
bearophile


More information about the Digitalmars-d-learn mailing list