[Bug 284953] typeid() returns mangled string that can't be demangled
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 08 Apr 2025 17:21:36 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284953
--- Comment #11 from Mark Millard <marklmi26-fbsd@yahoo.com> ---
(In reply to Dimitry Andric from comment #2)
(In reply to Mark Millard from comment #10)
Context: Itanium C++ ABI
Another relevant section is the one about __cxa_demangle(. . .).
Turns out it is very explicit about the _Z vs. not for the
use of std::type_info::name() results for that routine:
QUOTE
3.4 Demangler API
Synopsis:
namespace abi {
extern "C" char* __cxa_demangle (const char* mangled_name,
char* buf,
size_t* n,
int* status);
}
mangled-name is a pointer to a null-terminated array of characters.
It may be either an external name, i.e. with a "_Z" prefix,
or an internal NTBS mangling, e.g. of a type for type_info.
END QUOTE
So: Adding the _Z should not be required for decoding
std::type_info::name() results via use of __cxa_demangle( . . . ) .
If the Itanium C++ ABI is the context involved, then it looks like
this buzilla should be reopened and the upstream fix would be to
the __cxa_demangle implementation so that it does not require
_Z for what std::type_info::name() returns.
I cannot change the status.
Also:
The wording of 3.4 suggests that there may be other internal NTBS
naming that also should not require the _Z prefix. It looks like
separately adding a _Z prefix would be more of a work-around than
an actual fix. Knowing when to apply the workaround vs. not could
be messy.
--
You are receiving this mail because:
You are the assignee for the bug.