[Issue 1101] New: Can't not deduce template correctly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 5 23:02:12 PDT 2007


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

           Summary: Can't not deduce template correctly
           Product: D
           Version: 1.010
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: davidl at 126.com


the following is not compilable:

enum type{
        a,
        b,
}
template XX(uint a, uint c)
{
        uint XX(){ return (a*256+c);}
}

void main()
{
     int k=XX(cast(uint)type.a,cast(uint)type.b);  // can't match any template
declaration while it should
}

but a workaround as following is working fine :

enum type{
        a,
        b,
}
template XX(uint a, uint c)
{
        uint XX(){ return (a*256+c);}
}

void main()
{
     int k=XX!(cast(uint)type.a,cast(uint)type.b)();
}


-- 



More information about the Digitalmars-d-bugs mailing list