abstract class A{} class B : A{}
string foo(T : const(A))(T x){ return T.stringof; } void main(){ import std.typecons : Rebindable; import std.stdio : writeln; Rebindable!(const B) b = new B; auto bar = foo(b); assert(bar == "Rebindable!(const(B))"); }