public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/96299] Defaulted operator <=> implicitly deleted when a member has operator < and operator == and return type is specified
Date: Tue, 08 Dec 2020 20:13:15 +0000	[thread overview]
Message-ID: <bug-96299-4-C8IrBVqjOo@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96299-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96299

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:4ed1dc1275bba89af92bfc7d97c21b376e4c29c3

commit r11-5866-g4ed1dc1275bba89af92bfc7d97c21b376e4c29c3
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Dec 4 21:48:43 2020 -0500

    c++: Fix defaulted <=> fallback to < and == [PR96299]

    I thought I had implemented P1186R3, but apparently I didn't read it
closely
    enough to understand the point of the paper, namely that for a defaulted
    operator<=>, if a member type doesn't have a viable operator<=>, we will
use
    its operator< and operator== if the defaulted operator has an specific
    comparison category as its return type; the compiler can't guess if it
    should be strong_ordering or something else, but the user can make that
    choice explicit.

    The libstdc++ test change was necessary because of the change in
    genericize_spaceship from op0 > op1 to op1 < op0; this should be
equivalent,
    but isn't because of PR88173.

    gcc/cp/ChangeLog:

            PR c++/96299
            * cp-tree.h (build_new_op): Add overload that omits some parms.
            (genericize_spaceship): Add location_t parm.
            * constexpr.c (cxx_eval_binary_expression): Pass it.
            * cp-gimplify.c (genericize_spaceship): Pass it.
            * method.c (genericize_spaceship): Handle class-type arguments.
            (build_comparison_op): Fall back to op</== when appropriate.

    gcc/testsuite/ChangeLog:

            PR c++/96299
            * g++.dg/cpp2a/spaceship-synth-neg2.C: Move error.
            * g++.dg/cpp2a/spaceship-p1186.C: New test.

    libstdc++-v3/ChangeLog:

            PR c++/96299
            * testsuite/18_support/comparisons/algorithms/partial_order.cc:
            One more line needs to use VERIFY instead of static_assert.

  parent reply	other threads:[~2020-12-08 20:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 14:08 [Bug c++/96299] New: " gcc-bugzilla at mysko dot org
2020-10-07 17:26 ` [Bug c++/96299] " mpolacek at gcc dot gnu.org
2020-11-15  0:44 ` gcc-bugzilla at mysko dot org
2020-12-03 16:39 ` jakub at gcc dot gnu.org
2020-12-08 20:13 ` cvs-commit at gcc dot gnu.org [this message]
2020-12-08 20:13 ` jason at gcc dot gnu.org
2021-05-19 20:17 ` cvs-commit at gcc dot gnu.org
2021-05-19 20:17 ` cvs-commit at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-96299-4-C8IrBVqjOo@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).