[Issue 12620] New: Compiler picks lesser template specialization match for float array alias value parameters

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Apr 22 15:53:26 PDT 2014


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

          Issue ID: 12620
           Summary: Compiler picks lesser template specialization match
                    for float array alias value parameters
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: andrej.mitrovich at gmail.com

-----
template Foo(alias sym)         { pragma(msg, "Foo1"); }
template Foo(alias int[] sym)   { pragma(msg, "Foo2"); }
template Foo(alias float[] sym) { pragma(msg, "Foo3"); }

void main()
{
    alias foo1 = Foo!(1);      // instantiates #1, ok
    alias foo2 = Foo!([1]);    // instantiates #2, ok
    alias foo3 = Foo!([1.0]);  // instantiates #1 instead of #3!
}
-----

--


More information about the Digitalmars-d-bugs mailing list