i've found the solution: void put(T)(T mesh) { static if (is(T : MyClass!F, string F)) { writeln("put method: ", F); } else { static assert(0, "Invalid type '" ~ std.traits.fullyQualifiedName!T ~ "'."); } }