c++: More P2002 operator<=> refinements.
authorJason Merrill <jason@redhat.com>
Wed, 17 Jun 2020 20:22:33 +0000 (16:22 -0400)
committerJason Merrill <jason@redhat.com>
Thu, 18 Jun 2020 20:00:30 +0000 (16:00 -0400)
commitb56dc0fc6cc39fba9ed974c58a21cf5f7a264be1
tree4c1ae7089617958e3bb3754a8babd5cb10af711b
parente54353a72a0fd780a2f233a057f3f8121b476192
c++: More P2002 operator<=> refinements.

* Disallow && references.
* Allow empty unions.
* Improve diagnostics for a subobject comparison with
  non-comparison-category type.

gcc/cp/ChangeLog:

* method.c (early_check_defaulted_comparison): Check for &&.
(build_comparison_op): Allow empty union.  Diagnose non-category
type.
(common_comparison_type): Remove handling for non-category type.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/spaceship-ref1.C: New test.
* g++.dg/cpp2a/spaceship-synth-neg4.C: New test.
* g++.dg/cpp2a/spaceship-union1.C: New test.
gcc/cp/method.c
gcc/testsuite/g++.dg/cpp2a/spaceship-ref1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/spaceship-union1.C [new file with mode: 0644]