I'm trying to do something to this effect: template XYZ(Class) { ... static assert(index != -1, "No such annotation on " ~ typeid(Class)); ... } However, typeid is not a string and I can't do to!string. Nor is typeid().name implemented at compile time. What would be the correct way to do this?