Variadic template parameters T... bounding

Marc Schütz via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 2 06:47:43 PST 2016


On Tuesday, 2 February 2016 at 14:12:54 UTC, Daniel Kozak wrote:
> On Tuesday, 2 February 2016 at 13:57:54 UTC, Marc Schütz wrote:
>> On Tuesday, 2 February 2016 at 13:52:55 UTC, Marc Schütz wrote:
>>> The last call should work IMO, but it doesn't. I believe 
>>> that's a compiler bug.
>>
>> Filed:
>> https://issues.dlang.org/show_bug.cgi?id=15640
>
> I would say it is not a bug
> test!A(new B(), new C()); // works
> which is what I expected

The bug is that `T` is not automatically inferred to be `A`. 
That's not a restriction of type inference in general: if you mix 
ints and floats, the common type is deduced correctly, just not 
for classes.


More information about the Digitalmars-d-learn mailing list