Test case: class A { class B { void bar() { return foo!(int)(); } } int foo(T)() { return 42; } this() { b = new B(); } B b; } void main() { A a = new A(); a.b.bar(); } I think the problem is that prior to calling A.foo!(int) it tries to execute an A.invariant(), but `this' pointer is null for some reason.
I can't reproduce this with 2.067 HEAD