digitalmars.D - Template argument deduction is too strict
- Lars Kyllingstad (11/11) Oct 21 2008 The function template
- Jarrett Billingsley (4/15) Oct 21 2008 It's a bug that Walter tried to fix a while ago, didn't get right, and
- Walter Bright (8/20) Oct 21 2008 The code:
- Lars Kyllingstad (4/28) Oct 22 2008 Ok, must be that I'm using an outdated compiler, then. I am using 64-bit...
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?
-Lars
Oct 21 2008
On Tue, Oct 21, 2008 at 9:07 AM, Lars Kyllingstad
<public kyllingen.nospamnet> 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?
-Lars
It's a bug that Walter tried to fix a while ago, didn't get right, and
as far as I know _still_ hasn't gotten right.
Oct 21 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.
Oct 21 2008
Walter Bright wrote:Lars Kyllingstad wrote:Ok, must be that I'm using an outdated compiler, then. I am using 64-bit Linux, so I have to use GDC. (Right?) -LarsThe 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.
Oct 22 2008









"Jarrett Billingsley" <jarrett.billingsley gmail.com> 