From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 34D263858D3C; Thu, 25 May 2023 07:20:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 34D263858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684999214; bh=W9Iq5xj/Zyl19jZr9gwIBEeuptFUeO1HWnaeJaPl6js=; h=From:To:Subject:Date:From; b=LGQUFfLW/NyQxh+Spy5wEYLxt877gLGANhy7SeJsuPVxg6ebSiamoXt1L9cI/zZdQ L5HX/x9flC3Y0QAACc8I4yl+Gtp3RFZl5moDB7D+LSmiK/r/0FDkOtCtbeW9XD4Hxi X5fjhS1tgb2M11BLdF/fhKHIV5o+NyVibMfAEw/A= From: "joker.eph at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109963] New: ABI: unexpected layout ordering of `this` pointer in lambda capture Date: Thu, 25 May 2023 07:20:13 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: joker.eph 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=3D109963 Bug ID: 109963 Summary: ABI: unexpected layout ordering of `this` pointer in lambda capture Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: joker.eph at gmail dot com Target Milestone: --- See the discussion here: https://github.com/itanium-cxx-abi/cxx-abi/issues/= 141 Most recent post at the moment was calling out a possible implementation bu= g in GCC: > If compilers aren't going to give lambdas internal linkage in these situa= tions, the ABI needs to define a layout for them. As far as I can tell, Cla= ng, GCC, and ICC are all trying to use the same layout rule: explicit captu= res are added in declaration order, then implicit captures are added in the= source order of their ODR use in the lambda body. The exception which caus= es this incompatibility is that GCC seems to order implicit this arguments = (and only implicit ones) after the formal call arguments. I would argue tha= t that's just a GCC bug, and the this argument should be ordered as if it w= ere written in source. @jicama, do you agree?=