c++: P0847R7 (deducing this) - CWG2586 [PR102609]
commitbfad006b88ec26e91b7edf9cf9ad4aaf9b8a9727
authorwaffl3x <waffl3x@protonmail.com>
Sun, 7 Jan 2024 23:10:00 +0000 (7 23:10 +0000)
committerJason Merrill <jason@redhat.com>
Tue, 9 Jan 2024 20:59:04 +0000 (9 15:59 -0500)
treec69ac0ecb1af40a83972fb337c4a62229e01171e
parent07d09f0af100a9873982fba663800d87bfd73585
c++: P0847R7 (deducing this) - CWG2586 [PR102609]

This adds support for defaulted comparison operators and copy/move
assignment operators, as well as allowing user defined xobj copy/move
assignment operators. It turns out defaulted comparison operators already
worked though, so this just adds a test for them. Defaulted comparison
operators were not so nice and required a bit of a hack. Should work fine
though!

The diagnostics leave something to be desired, and there are some things
that could be improved with more extensive design changes. There are a few
notes left indicating where I think we could make improvements.

Aside from some small bugs, with this commit xobj member functions should be
feature complete.

PR c++/102609

gcc/cp/ChangeLog:

PR c++/102609
C++23 P0847R7 (deducing this) - CWG2586.
* decl.cc (copy_fn_p): Accept xobj copy assignment functions.
(move_signature_fn_p): Accept xobj move assignment functions.
* method.cc (do_build_copy_assign): Handle defaulted xobj member
functions.
(defaulted_late_check): Comment.
(defaultable_fn_check): Comment.

gcc/testsuite/ChangeLog:

PR c++/102609
C++23 P0847R7 (deducing this) - CWG2586.
* g++.dg/cpp23/explicit-obj-basic6.C: New test.
* g++.dg/cpp23/explicit-obj-default1.C: New test.
* g++.dg/cpp23/explicit-obj-default2.C: New test.

Signed-off-by: Waffl3x <waffl3x@protonmail.com>
gcc/cp/decl.cc
gcc/cp/method.cc
gcc/testsuite/g++.dg/cpp23/explicit-obj-basic6.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp23/explicit-obj-default1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp23/explicit-obj-default2.C [new file with mode: 0644]