[Issue 6805] New: Can't use a type from opDispatch template

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 12 06:54:35 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6805

           Summary: Can't use a type from opDispatch template
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: verylonglogin.reg at gmail.com


--- Comment #0 from Denis <verylonglogin.reg at gmail.com> 2011-10-12 06:53:44 PDT ---
---
struct T {
    template opDispatch(string name)
    {
        alias int Type;
    }
}

pragma(msg, T.opDispatch!("xxx"), " ", T.xxx); //(T).opDispatch!("xxx")
(T).opDispatch!("xxx")
pragma(msg, T.opDispatch!("xxx").Type, " ", T.xxx.Type); //int int
pragma(msg, is(T.opDispatch!("xxx").Type), " ", is(Flag.xxx.Type)); //true
false

template U(T) { }

void main() {
    T.opDispatch!("xxx").Type i1; //ok
    T.xxx.Type i2; //Error: T.xxx.Type is used as a type

    alias U!(T.opDispatch!("xxx").Type) U1; //ok
    alias U!(T.xxx.Type) U2; //Error: template instance U!(int) does not match
template declaration U(T)
}
---

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


More information about the Digitalmars-d-bugs mailing list