From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 541003851C21; Sun, 7 Jun 2020 23:34:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 541003851C21 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1591572842; bh=Qc6LvA8hbHpuXIIludIwRl4NxYxsxtZT/vvDFgjHs/o=; h=From:To:Subject:Date:From; b=EB5X4WOkzUM8r0pForzSAUZD9rC2YOoJqcFoh867J11p3vxBwSdk/ksW0fMAMob+A 5y+cc8Ji9doMxMbqc3Yls5OE0W7BtAtcm4bPID87POEoooPst2pLEru405V/z2ySbb 68CLtJqgCSvCVbKZ675Dt9wqjtSH9/C21zX7QLds= From: "barry.revzin at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95567] New: Defaulted virtual <=> has the wrong behavior Date: Sun, 07 Jun 2020 23:34:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Sun, 07 Jun 2020 23:34:02 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95567 Bug ID: 95567 Summary: Defaulted virtual <=3D> has the wrong behavior Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- Reduced from Twitter user @feder_and_ink: #include struct B { B(int i) : i(i) {} VIRTUAL std::strong_ordering operator<=3D>(B const& other) const =3D defa= ult; 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); } With -DVIRTUAL=3D, check() returns true. With -DVIRTUAL=3Dvirtual, check() erroneously returns false. On compiler explorer: https://godbolt.org/z/hc3U5f=