From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BFABE385841A; Wed, 7 Sep 2022 12:30:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BFABE385841A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662553817; bh=WgXEND+cyc4w+FMAgB/nojScSYWgBtgrVPRgWXTHDbQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rC/TARCz69uv2hiHyF1oiPOFdqf0bcSaUCOYDmhDvF/H4zVaHDyg/m0Q7vTj8DAX1 tkbP+pzzplOI6Dh6qH07dOCtyqWhejT0fKASDuvHmHG4iW2aYzkRnqIvbcrGBPec1V u+A9b+ueZC8YM3kC9Va5Yoy92buBxU+f4WsOc+Po= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/98978] Consider packing _M_Engaged in the tail padding of T in optional<> Date: Wed, 07 Sep 2022 12:30:17 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: ABI, missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: NEW 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: Message-ID: In-Reply-To: References: 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=3D98978 --- Comment #5 from Jonathan Wakely --- (In reply to andysem from comment #3) > Is there no way to improve standard components implementation? I'd imagine > you could provide the new implementation in the new version inline namesp= ace > and still support the old ABI for backward compatibility. To give a more complete answer: Inline namespaces don't help, that's a myth. struct X { std::optional b; }; Now one translation unit has X using the old ABI and one has X using the new ABI, but they're the same X. The fact that the two versions of optional are= in different namespaces is no help at all. You still have an ABI break. We did it for std::string and it was a multi-year effort that caused disrup= tion across the industry. It's not worth doing that again to save a few bytes in std::optional.=