I think the compiler can infer the type here: template Type(T) { alias T Type; } void bar(T)(Type!T t) {} void main() { int b = 1; bar!int(b); // OK bar(b); // template test.bar(T) does not match any function template declaration } Problem found by Nicolas / biozic: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=19054 The original code was: template Graph(T) { alias T[][T] Graph; } void add_edge(T)(ref Graph!(T) graph, T source, T target) { graph[source] ~= target; } void main() { Graph!(string) graph; graph.add_edge("A", "B"); // Error }
*** This issue has been marked as a duplicate of issue 1807 ***