The code:
import std.range;
void f(R)(R, void delegate(ElementType!R)) { }
void main() { f([1], (int x) { }); }
gives:
Error: template f does not match any function template declaration
Error: template f(R) cannot deduce template function from argument types !()(int[],void function(int x) pure nothrow @safe)
but it should obviously be able to infer the types...
Comment #1 by dlang+issues — 2012-05-21T23:40:53Z
Also another issue, likely to be related:
The code
import std.range;
void f(R)(R, void delegate(ElementType!(R))) { }
void main() { f([1], delegate void(x) { }); }
says
Error: undefined identifier R, did you mean template f(R)?
Error: ElementType!(_error_) is used as a type
Error: template f does not match any function template declaration
Error: template f(R) cannot deduce template function from argument types !()(int[],void)
even though 'R' and 'ElementType' are clearly both defined.
Comment #2 by hsteoh — 2014-06-30T18:15:55Z
Still happens on git HEAD (db18e36a1c060fff056ecfa88cf792edc8ef8c1d).
Comment #3 by hsteoh — 2019-02-06T22:53:20Z
Still happens on git HEAD (v2.084.0-395-gcb3a72613).
Comment #4 by robert.schadek — 2024-12-13T18:00:02Z