RTTI name generated for classes in anonymous namespaces do not begin with the prefix asterisk(*)

RTTI name generated for classes in anonymous namespaces do not begin with the prefix asterisk(*). Due to which type_info::operator== operator fails on GNU/linux (libstdc++ library) when compared to gcc.

is this divergence between clang and gcc accepted behavior?

Above problem is found in the issues listed below:

Per IA64 ABI: RTTI name for class in anonymous namespace lacks '*', breaks dynamic_cast and type_info::operator== on GNU/Linux · Issue #34255 · llvm/llvm-project · GitHub, I’m pretty sure this is an unintended behavior divergence from gcc/libstdc++ behavior. The concern has been around what to do about backward compatibility though.

1 Like

I agree, I think John’s comment on the issue captures it nicely: IA64 ABI: RTTI name for class in anonymous namespace lacks '*', breaks dynamic_cast and type_info::operator== on GNU/Linux · Issue #34255 · llvm/llvm-project · GitHub

Naively, I think we should match the same ABI (per target) by default and then use an ABI tag to allow users to get back to the old ABI if they need to for some reason.