From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1696A3858288; Sat, 22 Oct 2022 12:54:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1696A3858288 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666443278; bh=Sue3Flc5/LXx+vUn2u1D/2j/aphi33qZvck+Q7buvzc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JvvJYyzL+icAQsT3eVUFwq9PqskMtg2MuNEBd4o+PzdFgTGmv4WGONT1whwznPe3O b+Di7u301QDwyUnE36kBrrwpXtoMAs7mbNP3rMk+mHqJUYaQnAaLAUm1/qspyai3Ui 0NT17qH8xLCbEGr4OvLtVI+nq6Pn4ald0If/9fIY= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106644] [C++23] P2468R2 - The Equality Operator You Are Looking For Date: Sat, 22 Oct 2022 12:54:37 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106644 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek --- FYI, clang trunk now implements this DR. Rough testcase distilled from the paper + some extra tests from the LLVM te= st coverage of the paper, with just // ERR to mark expected diagnostics (details to be filled only once it is implemented). // P2468R2 - The Equality Operator You Are Looking For // { dg-do compile { target c++20 } } struct A { bool operator=3D=3D (const A &) { return true; } bool operator!=3D (const A &) { return false; } }; bool a =3D A{} !=3D A{}; template struct B { bool operator=3D=3D (const T &) const; bool operator!=3D (const T &) const; }; struct B1 : B { }; bool b1 =3D B1{} =3D=3D B1{}; bool b2 =3D B1{} !=3D B1{}; template struct C { using C1 =3D C; using C2 =3D C; C () =3D default; C (const C2 &); bool operator=3D=3D (C1) const; bool operator!=3D (C1) const; }; using C3 =3D C; bool c =3D C3{} =3D=3D C3{}; struct D { D (); D (int *); bool operator=3D=3D (const D &) const; operator int * () const; }; bool d =3D nullptr !=3D D{}; // ERR struct E { operator bool () const; }; unsigned char operator=3D=3D (E, E); unsigned char e =3D E{} !=3D E{}; // ERR struct F {}; template bool operator=3D=3D (F, T); bool f1 =3D 0 =3D=3D F (); template bool operator!=3D (F, T); bool f2 =3D 0 =3D=3D F (); // ERR struct G { bool operator=3D=3D (const G &); }; struct G1 : G { G1 (); G1 (G); bool operator!=3D (const G &); }; bool g1 =3D G () =3D=3D G1 (); bool g2 =3D G1 () =3D=3D G (); // ERR struct H {}; template bool operator=3D=3D (H, T); inline namespace H1 { template bool operator!=3D (H, T); } bool h =3D 0 =3D=3D H (); template struct I { int operator=3D=3D (const double &) const; friend inline int operator=3D=3D (const double &, const T &) { return 1; } }; struct I1 : I { }; bool i =3D I1{} =3D=3D 0.; // ERR struct J { bool operator=3D=3D (const J &) const; bool operator!=3D (const J &) const; }; struct J1 : J { J1 (const J &); bool operator=3D=3D (const J1 &x) const { return static_cast (*this) =3D=3D x; // ERR } }; struct K { bool operator=3D=3D (const K &); }; bool k =3D K{} =3D=3D K{}; // ERR struct L { bool operator=3D=3D (const L &) const; }; bool l =3D L{} =3D=3D L{}; struct M { bool operator=3D=3D (M); }; bool m =3D M () =3D=3D M (); struct N { virtual bool operator=3D=3D (const N &) const; }; struct N1 : N { bool operator=3D=3D (const N &) const override; }; bool n =3D N1 () =3D=3D N1 (); // ERR struct O { virtual signed char operator=3D=3D (const O &) const; signed char operator!=3D (const O &x) const { return !operator=3D=3D (x);= } }; struct O1 : O { signed char operator=3D=3D (const O &) const override; }; bool o =3D O1 () !=3D O1 (); // ERR template bool foo (T x, T y) requires requires { x =3D=3D y; } { return x =3D=3D y; } bool b3 =3D foo (B1 (), B1 ()); struct P {}; template bool operator=3D=3D (P, T); template bool operator!=3D (P, T); bool p =3D 0 =3D=3D P (); struct Q {}; template bool operator=3D=3D (Q, T); template bool operator!=3D (Q, U); bool q =3D 0 =3D=3D Q (); // ERR struct R { template bool operator=3D=3D (const T &); }; bool r =3D R () =3D=3D R (); // ERR struct S { template bool operator=3D=3D (const T &) const; bool operator!=3D (const S &); }; bool s =3D S () =3D=3D S (); struct T {}; template bool operator=3D=3D (T, int); bool operator!=3D (T, int); bool t =3D 0 =3D=3D T (); struct U {}; bool operator=3D=3D (U, int); bool u1 =3D 0 =3D=3D U (); namespace U1 { bool operator!=3D (U, int); } bool u2 =3D 0 =3D=3D U (); using U1::operator!=3D; bool u3 =3D 0 =3D=3D U (); // ERR struct V {}; template bool operator=3D=3D (V, T); bool v1 =3D 0 =3D=3D V (); namespace V1 { template bool operator!=3D (V, T); } bool v2 =3D 0 =3D=3D V (); using V1::operator!=3D; bool v3 =3D 0 =3D=3D V (); // ERR template struct W { bool operator=3D=3D (int) requires (N =3D=3D 1); bool operator!=3D (int) requires (N =3D=3D 2); }; int w =3D 0 =3D=3D W<1> (); struct X {=20 bool operator=3D=3D (X const &); static bool operator!=3D (X const &, X const &); }; bool x =3D X () =3D=3D X (); // ERR=