Consider this two-file project: // test.d import testmod; void main() { void whatever() {} foo!(whatever)(); } // testmod.d private void bar(alias a)() {} void foo(alias a)() { .bar!(a)(); } Compiling test.d yields: testmod.d(5): Error: function test.bar is not accessible from testmod test.d(6): template instance test.main.foo!(whatever) error instantiating (I thought I submitted this once, but I couldn't find it.)
The problems seems to be that the templates are being semantically analysed in the wrong scope.
This applies even to ancient versions of D1.
D2 patch: https://github.com/D-Programming-Language/dmd/pull/107
https://github.com/D-Programming-Language/dmd/commit/263cebdd1ec98b4a081f10734c5be0cd6d653a74 https://github.com/D-Programming-Language/dmd/commit/fc09715dfef7b6058784d3892dcb171f3893f4c3