Very sad, i thougth that was possible. As regards to "instanceof" Try this code: unittest { class A { mixin TRef!(typeof(this)); } class B : A { } class C : B { } A a1 = new B(); A a2 = new C(); assert(instanceof!(A)(a1) == false); assert(instanceof!(B)(a1)); assert(instanceof!(C)(a1) == false); } with my instanceof and then with your version.