public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug demangler/96143] New: C++ demangler should not add a lambda as a substitution
@ 2020-07-10  4:27 ian at airs dot com
  2020-07-10 12:41 ` [Bug demangler/96143] " nathan at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ian at airs dot com @ 2020-07-10  4:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96143
           Summary: C++ demangler should not add a lambda as a
                    substitution
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: demangler
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ian at airs dot com
  Target Milestone: ---

The C++ demangler adds a lambda as a substitution in d_lambda in
libiberty/cp-demangle.c.  However, the C++ compiler does not add a lambda as a
substitution in write_closure_type_name in cp/mangle.c.  According to
https://codesourcery.com/cxx-abi, the compiler is correct and the demangler is
not.

Here is a test case that shows the problem:

template<typename F>
struct A {
  typedef int X;
};

template<typename F>
inline typename A<F>::X
F2(F f) {
  return 0;
}

void F() {
  F2([]{});
}

This produces the symbol _Z2F2IZ1FvEUlvE_EN1AIT_E1XES2_, which is the type of
F2 instantiated with a lambda.  Currently the demangler demangles this as

A<F()::{lambda()#1}>::X F2<F()::{lambda()#1}>(A)

Note the final (A).  That does not make sense.  The argument type of F2 is not
A, which doesn't even make sense by itself.  The argument type is a lambda.

Compare to the output of llvm-cxxfilt:

A<F()::'lambda'()>::X F2<F()::'lambda'()>(F()::'lambda'())

Here the argument is correctly shown as a lambda.

I can send a patch.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-14 17:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-10  4:27 [Bug demangler/96143] New: C++ demangler should not add a lambda as a substitution ian at airs dot com
2020-07-10 12:41 ` [Bug demangler/96143] " nathan at gcc dot gnu.org
2020-07-14 17:27 ` cvs-commit at gcc dot gnu.org
2020-07-14 17:36 ` ian at airs dot com

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).