https://issues.dlang.org/show_bug.cgi?id=16301
Issue ID: 16301 Summary: CTFE execution of opApply keeps wrong "this" context in foreach's body Product: D Version: D2 Hardware: All URL: http://dlang.org/ OS: All Status: NEW Severity: enhancement Priority: P3 Component: dmd Assignee: nob...@puremagic.com Reporter: e...@weka.io struct OpApply { int opApply(scope int delegate(int) dlg) { return dlg(1); } } struct Foo { int i; this(int x) { foreach(_; OpApply()) { i = 0; // Error: couldn't find field i of type int in OpApply() } } } enum x = Foo(1); (also happens with this.i = 0). --