D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 12373 - opDispatch cannot resolve to a non-member template
Summary: opDispatch cannot resolve to a non-member template
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
: 11685 (view as issue list)
Depends on:
Blocks:
 
Reported: 2014-03-15 09:33 UTC by John Colvin
Modified: 2022-08-22 12:54 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description John Colvin 2014-03-15 09:33:55 UTC
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 John Colvin 2014-03-15 09:47:03 UTC
*** Issue 11685 has been marked as a duplicate of this issue. ***
Comment 2 RazvanN 2022-08-22 12:54:55 UTC
I cannot reproduce this. It seems to have been fixed. Closing as WORKSFORME.

Please reopen if I missed anything.