Template argument deduction is too strict
Walter Bright
newshound1 at digitalmars.com
Tue Oct 21 18:35:40 PDT 2008
Lars Kyllingstad wrote:
> The function template
> void foo(A)(A a, real b) { ... }
> is matched by
> foo(1, 1.0L);
> but not by
> foo(1, 1.0);
> since the second argument is a double literal.
>
> I think the latter should also work, since it would work for a
> non-templated function. Don't you agree? :)
>
> I am using D1, by the way. Is it the same in D2?
The code:
void foo(A)(A a, real b) { }
void test()
{
foo(1, 1.0);
}
compiles with both D1 and D2.
More information about the Digitalmars-d
mailing list