https://issues.dlang.org/show_bug.cgi?id=15640
Issue ID: 15640
Summary: type inference in variadic array params not working
for classes
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
void test(T)(T[] args...) {
import std.stdio;
writeln(T.stringof);
}
class A { }
class B : A { }
class C : A { }
void main()
{
test(1,2,3); // int
test(4,5,6.9); // double
test(new B(), new C());
}
=> template xx.test cannot deduce function from argument types !()(B, C)
IMO `T` should be inferred as `A`. Note that the common type is already chosen
for mixed numerical types; it's an arbitrary restriction for it not to work
with classes.
--