www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14420] New: partial template ordering with specialization and

https://issues.dlang.org/show_bug.cgi?id=14420

          Issue ID: 14420
           Summary: partial template ordering with specialization and
                    different arities seems broken
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

void foo(string op:"+", T)(ref T val, T mod)
{
}

void foo(string op, T, V1)(ref T val, V1 mod)
{
}

void main()
{
    int i32 = 12;
    foo!"+"(i32, 13); // should match first
    ubyte u8;
    foo!"+"(u8, 1);   // not sure about this one
}

---

Maybe my intuition is wrong here, but it's surprising that the first template
function which is specialized for op:"+" isn't called.

--
Apr 07 2015