digitalmars.D.bugs - [Issue 14604] New: "cannot resolve forward reference" when
- via Digitalmars-d-bugs (44/44) May 18 2015 https://issues.dlang.org/show_bug.cgi?id=14604
https://issues.dlang.org/show_bug.cgi?id=14604 Issue ID: 14604 Summary: "cannot resolve forward reference" when opDispatch results in a template Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: ag0aep6g gmail.com Probably related to issue 14603. ---- struct S { template opDispatch(string name) { void opDispatch()() {} } } alias a = S.opDispatch!"go"; /* ok */ version(none) alias b = S.go; /* "cannot alias an expression" - issue 14603 */ alias Identity(alias thing) = thing; alias c = Identity!(S.opDispatch!"go"); /* ok */ alias d = Identity!(S.go); /* 'Error: template instance opDispatch!"go" cannot resolve forward reference' */ ---- `S.go` should be equivalent to `S.opDispatch!"go"`. Workaround: ---- struct S { template opDispatch(string name) { auto impl(Args ...)(Args args) {} alias opDispatch = impl; } } ---- --
May 18 2015