https://issues.dlang.org/show_bug.cgi?id=16301
--- Comment #4 from Walter Bright <[email protected]> --- The following simpler code reproduces the problem: ------------------------ struct OpApply { void opApply(void delegate() dlg) { dlg(); } } struct Foo { int i; int abc() { auto o = OpApply(); void dg() { i = 0; } // couldn't find field i of type int in OpApply() o.opApply(&dg); return 0; } } void bar() { enum x = Foo().abc(); } --------------------------- This code fails in a similar manner, and also works outside of CTFE (replace enum with auto and it compiles): --------------------------- void opApply(void delegate() dlg) { dlg(); } struct Foo { int i; int abc() { void dg() { i = 0; } // value of 'this' is not known at compile time opApply(&dg); return 0; } } void bar() { enum x = Foo().abc(); } ------------------------- This stuff is pretty deep in the bowels of CTFE, which I don't really understand :-( --
