Bug 12373 – opDispatch cannot resolve to a non-member template

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-03-15T09:33:55Z
Last change time
2022-08-22T12:54:55Z
Assigned to
No Owner
Creator
John Colvin

Comments

Comment #0 by john.loughran.colvin — 2014-03-15T09:33:55Z
currently you can't have opDispatch resolve to a non-member template: //break.d struct A { template opDispatch(string s) { mixin("alias opDispatch = " ~ s ~ ";"); } } struct B() { enum blah = 42; } unittest { alias Q = A.B!(); pragma(msg, Q.blah); } $ rdmd -unittest break.d break.d(1): Error: struct f477.A template identifier 'B' is not a member of 'struct A' break.d(1): Error: struct f477.A template identifier 'B' is not a member of 'struct A' 42 As you can see, the code works, 42 is the answer! Unfortunately there's the error... note: I'm not sure whether this is a bug report or an enhancement request, as I don't know what the current design is supposed to allow.
Comment #1 by john.loughran.colvin — 2014-03-15T09:47:03Z
*** Issue 11685 has been marked as a duplicate of this issue. ***
Comment #2 by razvan.nitu1305 — 2022-08-22T12:54:55Z
I cannot reproduce this. It seems to have been fixed. Closing as WORKSFORME. Please reopen if I missed anything.