The following will not compile even though templateFunc is not automatically instantiated with A (there is no actual danger of a stack overflow). struct A(T1) { void templateFunc(T2)(T2 a) { alias A!(typeof(this)) error; } } void main() { A!int a; a.templateFunc!int(0); } Error: recursive template expansion for template argument A!(int)
This compiles without errors with v2.065.