digitalmars.D.bugs - [Issue 18863] New: opDispatch with WithStatement & Template Instance
- d-bugmail puremagic.com (58/58) May 15 2018 https://issues.dlang.org/show_bug.cgi?id=18863
https://issues.dlang.org/show_bug.cgi?id=18863 Issue ID: 18863 Summary: opDispatch with WithStatement & Template Instance Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: john.michael.hall gmail.com The with statement does not check opDispatch with template instances. An older template instances. See below: struct Foo(int x) { auto opDispatch(string s)() if (s == "bar") { x++; return x; } } void main() { int y = 0; with(Foo!1) { y = bar; //error: undefined identifier bar } assert(y == 2); } By contrast, the following compiles without error struct Foo { int x; auto opDispatch(string s)() if (s == "bar") { x++; return x; } } void main() { int y = 0; with(Foo(1)) { y = bar; } assert(y == 2); } Discussion thread: https://forum.dlang.org/thread/becssptpaecvxddbrpbw forum.dlang.org --
May 15 2018