From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9A9663840C33; Tue, 9 Jun 2020 14:52:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A9663840C33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1591714345; bh=Ty3TCEg7Ug5fJBTVXL3OPPriGTJbKxruWXngh+DccPo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bzSWL6cCekwJgxlmL752ntCtUq5ropXCGyzd5qJxTB6adQL5AOpgWg8p4kz1ffoUR QZwngcgBjPjSgBkYuAL/ExPfeoG46bjggK9YvUBqbRj4NnkoCzf1LLJiCYW8T5rD25 vrzu230M8cj9ijF0VJ+M8Lnjnc0UF0zBSlYojq+M= From: "barry.revzin at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95567] Defaulted virtual <=> has the wrong behavior Date: Tue, 09 Jun 2020 14:52:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: barry.revzin 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: 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, 09 Jun 2020 14:52:25 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95567 --- Comment #1 from Barry Revzin --- To follow up on this, it's not the operator<=3D> being virtual that's signi= ficant but rather the class itself being polymorphic. This exhibits the same behav= ior: #include struct B { B(int i) : i(i) {} VIRTUAL ~B() =3D default; std::strong_ordering operator<=3D>(B const& other) const =3D default; int i; }; struct D : B { D(int i, int j) : B(i), j(j) {} int j; }; bool check() { return B(2) =3D=3D D(2, 3); } https://godbolt.org/z/ZFqB59=