$ cat a.d import b; void fa() { fb!int(); } $ cat b.d struct S(T) { void fs() { fb!int(); } } S!T fb(T)() { return S!T(); } $ dmd -c -o- a b $ dmd -c -o- b a b.d(3): Error: forward reference to fb b.d(6): Error: template instance b.S!(int) error instantiating a.d(3): instantiated from here: fb!(int) a.d(3): Error: template instance b.fb!(int) error instantiating
See also issue 7904
Seems fixed in 2.064.