(Not tested with the latest bug fixes, so this can be already fixed) int foo() { int[] arr = new int[1]; int s; foreach (x; arr) s += x; foreach (x; arr) s += x * x; return 0; } enum int _ = foo(); void main() {} dmd 2.042 gives: Error: Integer constant expression expected instead of null test.d(10): Error: cannot evaluate foo() at compile time test.d(10): Error: cannot evaluate foo() at compile time
The patch to bug 4078 fixes this.
http://www.dsource.org/projects/dmd/changeset/507