The following code: void foo(T)(T delegate(in Object) dlg) { } void bar() { foo( (in Object) { return 15; } ); } does not compile: > dmd -c bug_template_in.d bug_template_in.d(7): template bug_template_in.foo(T) does not match any function template declaration bug_template_in.d(7): template bug_template_in.foo(T) cannot deduce template function from argument types !()(int delegate(const(Object) _param_0)) Replacing both instances of 'in Object' with 'const(Object)' makes the code compile. I think these two forms are equivalent and should both compile.
https://github.com/D-Programming-Language/dmd/pull/111
https://github.com/D-Programming-Language/dmd/commit/706d7c721974a443625f5bc1ed11d73a360faf80