When you declare a template lambda: immutable lambda(T) = (T n) => n * n; and call it without an explicit type it errors with with: lambda cannot deduce function from argument types !()(int) auto x = lambda!int(2); // works auto x = lambda(2); // not works Is this a bug? - tired on dmd v2.077.1
Tested back to 2.070.0, which is where short lambda syntax was introduced. Still fails. The immutable looks odd, but even with alias this doesn't work. alias lambda(T) = (T n) => n * n; should expand to: template lambda(T) { alias lambda = (T n) => n * n; } Neither of these successfully use IFTI. However, these all work: alias lambda = (int n) => n * n; alias lambda = n => n * n;