I think what you are looking for is Class.stringof: template XYZ(Class) { // ... static assert(index != -1, "No such annotation on "~ Class.stringof) ); // ... }