Error: cannot evaluate foo() at compile time struct S { int x; } int foo() { S[] a = []; a ~= S(); a[0].x = 1; // Fails return 0; } enum x = foo(); Btw, CTFE is relatively difficult to debug. More informative messages than "cannot evaluate ... at compile time" would be appreciated.
This applies to D1.0 as well. For D1.0, change last line of test case to: int x = foo();
Patch included in patch for bug#2569.
Fixed dmd 1.047 and 2.032