July 20, 2016 [Issue 16301] New: CTFE execution of opApply keeps wrong "this" context in foreach's body | ||||
|---|---|---|---|---|
| ||||
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: nobody@puremagic.com Reporter: eyal@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). -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply