[Issue 12620] Compiler picks lesser template specialization match for float array alias value parameters
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Apr 23 14:37:19 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12620
--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> ---
(In reply to Andrej Mitrovic from comment #0)
> -----
> 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!
> }
> -----
Changing the third overload to use double[] instead of float[] fixes this. So
it must be some issue with a missed implicit conversion.
--
More information about the Digitalmars-d-bugs
mailing list