Bug 14604 – "cannot resolve forward reference" when opDispatch results in a template

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-05-18T20:04:00Z
Last change time
2016-02-29T17:48:08Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
ag0aep6g
Depends on
15310

Comments

Comment #0 by ag0aep6g — 2015-05-18T20:04:53Z
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; } } ----
Comment #1 by k.hara.pg — 2015-06-07T08:23:36Z
Comment #2 by github-bugzilla — 2016-02-29T17:48:08Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/359b6c5030dbcbb46fa762e53217ce4b4ebb35e0 fix Issue 14604 - "cannot resolve forward reference" when opDispatch results in a template https://github.com/D-Programming-Language/dmd/commit/e5e8f3f9d468f9fafe5de9455f8dfed15b7fb035 Merge pull request #4726 from 9rnsr/fix14603 Issue 14603 & 14604 - aliasing opDispatch result