From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 212623857838; Fri, 18 Nov 2022 01:05:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 212623857838 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668733518; bh=D3wQTOwBvrMIJW6qbitsHzRsyUotpL0BBsn3cIGouIc=; h=From:To:Subject:Date:From; b=st880X5f4IRcnaRxA3fF8moYr2YMlba3NlI5XkNdiMdPhzOhU9hefdcBXoqxQy/bB gPCNwH1A7xXM3vUg9HjH5Ntns9EeT1Vq0BIU1t0u12+LhZLsSQZmRFsrwqsC8eRVmC NquCauu8LPiout7+EMiNLq23nm6iMHiqlVlGMPK0= From: "dblaikie at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107741] New: Missed member variable name in mangling of externally visible lambdas used in inline initialization of static members Date: Fri, 18 Nov 2022 01:05:17 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dblaikie at gmail 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107741 Bug ID: 107741 Summary: Missed member variable name in mangling of externally visible lambdas used in inline initialization of static members Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dblaikie at gmail dot com Target Milestone: --- https://godbolt.org/z/7514cTh5o ``` struct A { static constexpr auto x =3D [] { return 1; }; }; template struct B { static constexpr auto x =3D [] { return 1; }; }; template struct C { static int x; }; void side_effect(); template int C::x =3D (side_effect(), [] { return 1; }()); template int C::x; void f() { A::x(); B::x(); } ``` GCC produces these manglings: ``` A::{lambda()#1}::operator()() const _ZNK1AUlvE_clEv B::{lambda()#3}::operator()() const _ZNK1BIiEUlvE1_clEv C::x::{lambda()#1}::operator()() const _ZNK1CIiE1xMUlvE_clEv ``` I believe in the first two cases, the member variable scope ("::x") is miss= ing. Oh, and it looks like the lambda numbering is off - B's lambda is 1 within = its scope (either the type or the member) - so I guess that needs to be fixed too/scoping the numbering to within the member along with the mangling havi= ng that scoping.=