From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B627C385C419; Sat, 8 Jan 2022 16:35:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B627C385C419 From: "ppalka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/94061] defaulted member operator <=> defined as deleted if a base has protected member operator <=> Date: Sat, 08 Jan 2022 16:35:52 +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: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: ppalka at gcc dot gnu.org 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: cc 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: Sat, 08 Jan 2022 16:35:52 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94061 Patrick Palka changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ppalka at gcc dot gnu.org --- Comment #2 from Patrick Palka --- (In reply to Frank Heckenbach from comment #1) > I ran into the same problem. >=20 > Interestingly, clang also seems to reject it, so maybe it is wrong by the > letter of the standard? Though it would seem strange to me -- after all, > when manually implementing B::operator<=3D> a protected operator in A wil= l do > fine. How do you define it? It works if we define it as auto operator <=3D> (const B& b) const { return A::operator<=3D>(b); } but not if it's defined as auto operator <=3D> (const B& b) const { return static_cast(*this) <=3D> static_cast(b); } According to [class.spaceship], IIUC the synthesized operator<=3D> looks mo= re similar to the latter invalid definition (invoking <=3D> recursively as an operator expression on each pair of corresponding subobjects), so GCC/Clang might be right to define it as deleted.=