I have been using this function for quite some time in Qt5:
static QString demangle( const QString &name )
{
int status;
std::unique_ptr< char, void(*)( void* ) > res (
abi::__cxa_demangle( name.toLatin1(), nullptr, nullptr, &status ), std::free );
return { ( status == 0 ) ? QLatin1String( res.get() ) : name };
}
Since starting to use Qt6,
ct_Halt( demangle(typeid (QStringList).name() ), demangle(typeid (QList<QString>).name() ) );
now produces
QString demangle(typeid (QStringList).name() )
"QList<QString>" // This used to produce QStringList in Qt5
QString demangle(typeid (QList<QString>).name() )
"QList<QString>"
This little annoyance has broken a library that I created. Its not a big deal but I'd like to know if the demangle function can be "fixed" to accurately reflect the typename.