From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D6365385802A; Tue, 26 Jan 2021 21:45:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D6365385802A From: "gcc@nicholas-schwab.de" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/98842] optional's spaceship operations generates wrong code when operator== is not present Date: Tue, 26 Jan 2021 21:45:24 +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: X-Bugzilla-Severity: normal X-Bugzilla-Who: gcc@nicholas-schwab.de 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: attachments.created 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: Tue, 26 Jan 2021 21:45:24 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98842 --- Comment #2 from gcc@nicholas-schwab.de --- Created attachment 50063 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D50063&action=3Dedit Patch operator<=3D> The operator<=3D>(optional<_Tp>, _Up) is currently underconstrained. cf http://eel.is/c++draft/optional.comp.with.t#25 . This patch fixes this by adding the constraint three_way_comparable_with<_Tp> for _Up. Then in the program that started this bug report=20 std::optional{} <=3D> std::optional{}=20 will not compile if operator=3D=3D(expr, expr) is not declared.=