I have...

import std.stdio;

int main(string[] args) {
        foo([[1,2],[3,4],[5,6]]); // ERROR [1]
        bar([[1,2],[3,4],[5,6]]); // OK
        foo!int([[1,2],[3,4],[5,6]]); // OK

        return 0;
}

void foo(T)(T[2][] t) {
        writeln(typeid(t));
}

void bar(T)(T[][] t) {
        writeln(typeid(t));
}

[1]
src\main.d(4): Error: template main.foo(T) does not match any function template declaration src\main.d(4): Error: template main.foo(T) cannot deduce template function from argument types !()(int[][])


Why can't compiler deduce template parameters from arguments in the first instantiation?

Thanks in advance,
Tom;

Reply via email to