https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97091

            Bug ID: 97091
           Summary: Demangling the name of the type of a lambda accepting
                    variadic auto parameters fails
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dominik.muth at gmx dot de
  Target Milestone: ---

Demangling the mangled name of [](auto...){} fails with gcc 5, 8, 9, 10, and
11.

It works with gcc 6 and 7, however the mangled name is different, see output
below. The demangled name main::{lambda(auto:1, ...)#1} looks wrong to me.
Should it be main::{lambda(auto:1...)#1} instead?

Here is a fairly minimal example to reproduce the bug:

// https://wandbox.org/permlink/FVonGE60X1Xi651E

#include <iostream>
#include <cxxabi.h>

using namespace std;

template <typename T>
static string nametype(T v)
{
    return typeid(decltype(v)).name();
}

template <typename T>
static string strtype(T v)
{
    return abi::__cxa_demangle(nametype(v).c_str(), nullptr, nullptr, nullptr);
}

template <typename T>
static void puttype(T v)
{
    cout << nametype(v) << endl;
    cout << "-> " << strtype(v) << endl;
}

int main()
{
    cout << __GNUC__ << "." << __GNUC_MINOR__ << "." << __GNUC_PATCHLEVEL__ <<
" " << __GLIBCXX__ << endl;
    puttype([](auto...){});
}

/*

output:

5.5.0 20171010
Z4mainEUlT_zE_
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid

6.3.0 20161221
Z4mainEUlT_zE_
-> main::{lambda(auto:1, ...)#1}

7.3.0 20180125
Z4mainEUlT_zE_
-> main::{lambda(auto:1, ...)#1}

8.3.0 20190222
Z4mainEUlDpT_E0_
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid

9.3.0 20200312
Z4mainEUlDpT_E0_
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid

10.1.0 20200507
Z4mainEUlDpT_E_
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid

11.0.0 20200915
Z4mainEUlDpT_E_
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid

*/

Reply via email to