c++: implicit operator== adjustments from P2002.
authorJason Merrill <jason@redhat.com>
Mon, 15 Jun 2020 21:11:38 +0000 (17:11 -0400)
committerJason Merrill <jason@redhat.com>
Wed, 17 Jun 2020 19:08:42 +0000 (15:08 -0400)
commit44492e248cbff60b12f5cbdaa32b265c5e8c9aff
tree4be0a18736a2e007ab79abef27ef49154840f581
parent68df8e8c3438dda209c3ad9843933da640c9a71c
c++: implicit operator== adjustments from P2002.

P2002R1, adopted at the February C++ meeting, made several refinements to
the wording for operator<=>.  This implements clarifications in how the
implicit operator== is declared: as a duplicate of the operator<=>, with
only the return type and name changed.  To that end I factored out the
declaration copying from build_clone.

gcc/cp/ChangeLog:

* cp-tree.h (copy_fndecl_with_name): Declare.
* class.c (copy_fndecl_with_name): Split out from...
(build_clone): ...here.
(add_implicitly_declared_members): Add op== to TYPE_FIELDS.
* method.c (implicitly_declare_fn): Use copy_fndecl_with_name.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/spaceship-synth9.C: New test.
gcc/cp/class.c
gcc/cp/cp-tree.h
gcc/cp/method.c
gcc/testsuite/g++.dg/cpp2a/spaceship-synth9.C [new file with mode: 0644]