From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F026C3857C68; Fri, 5 Feb 2021 20:44:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F026C3857C68 From: "andysem at mail dot ru" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/98978] Consider packing _M_Engaged in the tail padding of T in optional<> Date: Fri, 05 Feb 2021 20:44:41 +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 X-Bugzilla-Severity: normal X-Bugzilla-Who: andysem at mail dot ru 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: 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 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, 05 Feb 2021 20:44:42 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98978 --- Comment #3 from andysem at mail dot ru --- (In reply to Jonathan Wakely from comment #1) > This would be an ABI break, and so not going to happen. Is there no way to improve standard components implementation? I'd imagine = you could provide the new implementation in the new version inline namespace and still support the old ABI for backward compatibility. (In reply to Jonathan Wakely from comment #2) > If we were going to do this, we could also make std::optional occup= y a > single byte, using one bit for the value and one for the engaged flag. This would be more problematic as emplace(), value() and operator*() need to return T&, which would not be possible.=