www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12373] New: opDispatch cannot resolve to a non-member template

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12373

           Summary: opDispatch cannot resolve to a non-member template
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: john.loughran.colvin gmail.com


--- Comment #0 from John Colvin <john.loughran.colvin gmail.com> 2014-03-15
16:33:55 GMT ---
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.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 15 2014
parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12373



--- Comment #1 from John Colvin <john.loughran.colvin gmail.com> 2014-03-15
16:47:03 GMT ---
*** Issue 11685 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 15 2014