"cannot deduce function from argument types" issue.
ted via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Feb 10 00:31:35 PST 2015
Hi!
I get the following compile error (linux, dmd2.066.1):
test.d(13): Error: template test.testFunc cannot deduce function from
argument types !()(double[], double), candidates are:
test.d(3): test.testFunc(R)(R range, ElementType!R foo)
For the following test file:
import std.range: ElementType, isInputRange;
ElementType!R testFunc(R)( R range, ElementType!R foo) // compiles with
double foo
{
static assert( isInputRange!R );
ElementType!R retVal = foo*foo;
return retVal;
}
void main()
{
double[] values = [0.0, 3.0, -1.0, 5.0];
auto result = testFunc( values, 8.8 );
}
And I'm not sure what I'm doing incorrectly. It compiles/works fine if I
hardcode the type for foo.
Could someone enlighten me ?
regards,
ted
More information about the Digitalmars-d-learn
mailing list