public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: Patrick Palka <ppalka@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH, v5] c++: Fix up synthetization of defaulted comparison operators on classes with bitfields [PR102490]
Date: Wed, 6 Oct 2021 11:06:40 +0200	[thread overview]
Message-ID: <20211006090640.GD304296@tucnak> (raw)
In-Reply-To: <c14b8077-5baf-8af4-40d3-79bdba3ae6b9@redhat.com>

On Tue, Oct 05, 2021 at 10:40:45PM -0400, Jason Merrill wrote:
> I've switched to handling bases via binfo as discussed on IRC and added
> spaceship-synth14.C to test proper base handling with virtual <=>. Here's
> what I'm committing:

Thanks a lot.

I see spaceship-synth8.C is accepted without errors (| LOOKUP_NONVIRTUAL |
LOOKUP_DEFAULTED didn't help it for me back when playing with it), but if I add

E e1, e2;
auto x = e1 <=> e2;
at the end of it, it is rejected:
spaceship-synth8.C:26:17: error: use of deleted function ‘virtual constexpr std::strong_ordering E::operator<=>(const E&) const’
   26 | auto x = e1 <=> e2;
      |                 ^~
spaceship-synth8.C:22:24: note: ‘virtual constexpr std::strong_ordering E::operator<=>(const E&) const’ is implicitly deleted because the default definition would be ill-formed:
   22 |   std::strong_ordering operator<=>(const E&) const override = default;
      |                        ^~~~~~~~
spaceship-synth8.C:21:8: error: no match for ‘operator<=>’ (operand types are ‘const D’ and ‘const D’)
   21 | struct E : D {
      |        ^
spaceship-synth8.C:19:32: note: candidate: ‘virtual std::strong_ordering D::operator<=>(const E&) const’ (reversed)
   19 |   virtual std::strong_ordering operator<=>(const struct E&) const = 0;
      |                                ^~~~~~~~
spaceship-synth8.C:19:44: note:   no known conversion for argument 1 from ‘const D’ to ‘const E&’
   19 |   virtual std::strong_ordering operator<=>(const struct E&) const = 0;
      |                                            ^~~~~~~~~~~~~~~

Is that ok (i.e. whether it is accepted or rejected when the operator<=>
is actually not called falls into "no diagnostics required" category)?

Note, before this fix we were accepting it even with those
E e1, e2;
auto x = e1 <=> e2;
lines in there.  Perhaps we want to copy spaceship-synth8.C to another
test that will add those two lines and check for the errors...

	Jakub


  reply	other threads:[~2021-10-06  9:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-28  9:24 [PATCH] " Jakub Jelinek
2021-09-28 13:49 ` Patrick Palka
2021-09-28 13:53   ` Patrick Palka
2021-09-28 19:33     ` Jason Merrill
2021-09-28 20:34       ` [PATCH, v2] " Jakub Jelinek
2021-09-29  8:07         ` Jakub Jelinek
2021-09-29 18:14         ` Jason Merrill
2021-09-29 19:21           ` Jakub Jelinek
2021-09-29 19:38             ` Jason Merrill
2021-09-30 17:24               ` [PATCH, v3] " Jakub Jelinek
2021-09-30 19:01                 ` Jason Merrill
2021-10-01 15:07                   ` [PATCH, v4] " Jakub Jelinek
2021-10-06  2:40                     ` [PATCH, v5] " Jason Merrill
2021-10-06  9:06                       ` Jakub Jelinek [this message]
2021-10-06 21:13                         ` Jason Merrill
2021-09-28 13:56   ` [PATCH] " Jakub Jelinek
2021-09-28 16:44     ` Patrick Palka
2021-09-28 16:49       ` Jakub Jelinek
2021-09-28 16:55         ` Jakub Jelinek
2021-09-28 17:25           ` Patrick Palka
2021-09-28 18:04             ` Jakub Jelinek

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=20211006090640.GD304296@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=ppalka@redhat.com \
    /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).