c++: Allow defaulted comparison outside class.
authorJason Merrill <jason@redhat.com>
Thu, 18 Jun 2020 21:41:43 +0000 (17:41 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 19 Jun 2020 16:25:37 +0000 (12:25 -0400)
commit4058454c9e0ee141d049cefa8db315a345a4b30a
treea12833a627dc92f855820c1d6d391e72e15cc19b
parent4cea81adabd7660838ebb3e59e8d28f820a3b789
c++: Allow defaulted comparison outside class.

Implementing P2085, another refinement to the operator<=> specification from
the Prague meeting.  It was deemed desirable to be able to have a non-inline
defaulted definition of a comparison operator just like you can with other
defaulted functions.

gcc/cp/ChangeLog:

* method.c (early_check_defaulted_comparison): Allow defaulting
comparison outside class.  Complain if non-member operator isn't a
friend.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/spaceship-friend1.C: New test.
* g++.dg/cpp2a/spaceship-err4.C: Adjust diagnostic.
gcc/cp/method.c
gcc/testsuite/g++.dg/cpp2a/spaceship-err4.C
gcc/testsuite/g++.dg/cpp2a/spaceship-friend1.C [new file with mode: 0644]