Which version of gcc are you using? I believe that user defined literals are supported from version 4.7
User-defined literals are in 4.7, but MinGW (the Windows port of GCC that I use) is still at 4.6.
If I was using 4.7, how would that be done?
Something like this?
template<class Arg>
constexpr const char *operator"" TypeName( const char * /* Ignore */)
{
return typeid(Arg).name();
}
"Name of type is: " ## "dummyText"TypeName<Arg>
I'm happy with my current error message ([size=2][color=#008000]""[color=#C0C0C0] [color=#000000]#newTypeName[color=#C0C0C0] [color=#008000]"[color=#C0C0C0] [color=#008000]is[color=#C0C0C0] [color=#008000]not[color=#C0C0C0] [color=#008000]implicitely[color=#C0C0C0] [color=#008000]convertible[color=#C0C0C0] [color=#008000]with[color=#C0C0C0] [color=#008000]"[color=#C0C0C0] [color=#000000]#parentType[color=#C0C0C0] [color=#008000]"-derived[color=#C0C0C0] [color=#008000]classes[color=#C0C0C0] [color=#008000]or[color=#C0C0C0] [color=#008000]strong[color=#C0C0C0] [color=#008000]"[color=#C0C0C0] [color=#000000]#parentType[color=#C0C0C0] [color=#008000]"[color=#C0C0C0] [color=#008000][size=2]typedefs"), but am still curious about the answer to the original problem (compile-time template arg name).