From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6CDE3385DC00; Fri, 10 Jul 2020 04:27:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6CDE3385DC00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594355250; bh=h17DrdPY9lKSN2W2NEtM4R+Af6/lPVZxogQleGMexp4=; h=From:To:Subject:Date:From; b=eBbg2fVRA3L55onb35oRBftB5EQbgjqidH4FFR+IG75v5HMLZ2eosEbjFGH91+EgV aJpwu0kP+d1cQXNjA/M+A/gbmNp8hzxlaqU8KCq21bNA2Jlc6uA54KCQPIVGCaKaOi 4pnJe13HGVWzhBe8Ffo068UObwsDtS2q/JemtPjE= From: "ian at airs dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug demangler/96143] New: C++ demangler should not add a lambda as a substitution Date: Fri, 10 Jul 2020 04:27:30 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: demangler X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ian at airs dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jul 2020 04:27:30 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96143 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 a= s 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 struct A { typedef int X; }; template inline typename A::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::X F2(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::X F2(F()::'lambda'()) Here the argument is correctly shown as a lambda. I can send a patch.=