https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123988
Bug ID: 123988
Summary: Long names are not demangled when printing stack
traces.
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: d7d1cd at mail dot ru
Target Milestone: ---
If the name of a stack trace frame function is long enough, then demangling of
such a name is not performed when printing the trace using
std::stacktrace::current(). Example code:
template<size_t Sz, template<typename> typename Templ>
struct Foo : std::type_identity<Templ<typename Foo<Sz - 1, Templ>::type>>
{};
template<template<typename> typename Templ>
struct Foo<0, Templ> : std::type_identity<void> {};
template<typename>
struct Type {
void bar() { std::println("{}", std::stacktrace::current()); }
};
int main() {
Type<Foo<198, std::type_identity>::type> t;
t.bar();
Type<Foo<199, std::type_identity>::type> t2;
t2.bar();
}
The first call to bar will print the stack trace with demangled names, the
second with mangled ones.
An example on godbolt is here: https://godbolt.org/z/P1brzEEnd