https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96345
Derek Huang <djh458 at stern dot nyu.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |djh458 at stern dot nyu.edu --- Comment #7 from Derek Huang <djh458 at stern dot nyu.edu> --- I'm using GCC 11.3 and see the same issue with __cxa_demangle. In my case, I have a C++ template specialization where the mangled type name exceeds 1k characters. I guess c++filt and nm (using nm -C) are both using __cxa_demangle, as both were unable to demangle that very long type name as well as a couple others created from related specializations of the template. Originally (several months ago), I worked around this issue with abi::__cxa_demangle by using llvm::itaniumDemangle. However, I recently spent some time using compile-time parsing of __PRETTY_FUNCTION__ to get a demangled type name, and I see that __PRETTY_FUNCTION__ *does* demangle properly. So if you need a workaround, there are a couple options: 1. Use llvm::itaniumDemangle by static linking against LLVMDemangle 2. Parse __PRETTY_FUNCTION__ with something like the following: // requires C++17 for std::string_view and constexpr std::begin template <typename T> constexpr std::string_view type_name() noexcept { auto begin = std::begin(__PRETTY_FUNCTION__); /* advance begin to where the T type begins */ auto end = begin; /* advance end to where the T type ends */ return {begin, static_cast<std::size_t>(end - begin)}; } It would be nice to have __cxa_demangle working, however, as it is the official way to demangle a string mangled following the Itanium ABI.