public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dominik.muth at gmx dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/97091] New: Demangling the name of the type of a lambda accepting variadic auto parameters fails
Date: Thu, 17 Sep 2020 16:20:07 +0000	[thread overview]
Message-ID: <bug-97091-4@http.gcc.gnu.org/bugzilla/> (raw)

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	other threads:[~2020-09-17 16:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17 16:20 dominik.muth at gmx dot de [this message]
2022-10-07 16:56 ` [Bug demangler/97091] " ppalka at gcc dot gnu.org
2022-10-07 17:05 ` ppalka at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-97091-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).