This D2 code compiles and runs with no errors (DMD 2.053beta), but it's wrong: void main() { enum int[][] data = [[1]]; foreach (a; data) a[0]++; assert(data[0][0] == 1); foreach (ref a; data) a[0]++; assert(data[0][0] == 1); }
Issue still exists as of v2.065.
The `enum` gives a literal, so the compiler is correct here. The code works as expected. Using `[static] immutable` will give the desired error.