libstdc++: Add comparison operators to std::shared_ptr (PR 94562)
authorJonathan Wakely <jwakely@redhat.com>
Tue, 14 Apr 2020 20:54:55 +0000 (21:54 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 14 Apr 2020 20:54:55 +0000 (21:54 +0100)
commitf5fa62ed19a1c85cda920bbe05eb075d8f2a0b42
tree902220d77e6fcfdebc238796ecb183448a03250a
parenta126a1577ffcbf62d97723b35d343bdff014bb40
libstdc++: Add comparison operators to std::shared_ptr (PR 94562)

This also implements the proposed resolution to LWG issue 3247, so that
the ill-formed <=> expression with nullptr is not used.

PR libstdc++/94562
* include/bits/shared_ptr.h (operator<=>): Define for C++20.
* include/bits/shared_ptr_base.h (operator<=>): Likewise.
* include/bits/unique_ptr.h (operator<=>): Add inline specifier.
* testsuite/20_util/shared_ptr/comparison/cmp_c++20.cc: New test.
* testsuite/20_util/shared_ptr/comparison/less.cc: Do not expect
std::less<A*> to be used when comparing std::shared_ptr<A> objects in
C++20.
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/shared_ptr.h
libstdc++-v3/include/bits/shared_ptr_base.h
libstdc++-v3/include/bits/unique_ptr.h
libstdc++-v3/testsuite/20_util/shared_ptr/comparison/cmp_c++20.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/shared_ptr/comparison/less.cc