libstdc++: Add comparison operators to std::unique_ptr
authorJonathan Wakely <jwakely@redhat.com>
Thu, 9 Apr 2020 20:10:32 +0000 (21:10 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 9 Apr 2020 20:10:32 +0000 (21:10 +0100)
commit5b074864f8c593fd4bccee788a023a37b446b2ed
tree8e7e2ca118c67d8bc65f9c9b8bb38e7379e13e50
parent07432a807ede1c629f0f52aa5f8bf00012929e88
libstdc++: Add comparison operators to std::unique_ptr

Some more C++20 changes from P1614R2, "The Mothership has Landed".

This includes the proposed resolution for LWG 3426 to fix the three-way
comparison with nullptr_t.

The existing tests for unique_ptr comparisons don't actually check the
results, only that the expressions compile and are convertible to bool.
This also adds a test for the results of those comparisons for C++11 and
up.

* include/bits/unique_ptr.h (operator<=>): Define for C++20.
* testsuite/20_util/default_delete/48631_neg.cc: Adjust dg-error line.
* testsuite/20_util/default_delete/void_neg.cc: Likewise.
* testsuite/20_util/unique_ptr/comparison/compare.cc: New test.
* testsuite/20_util/unique_ptr/comparison/compare_c++20.cc: New test.
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/unique_ptr.h
libstdc++-v3/testsuite/20_util/default_delete/48631_neg.cc
libstdc++-v3/testsuite/20_util/default_delete/void_neg.cc
libstdc++-v3/testsuite/20_util/unique_ptr/comparison/compare.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/unique_ptr/comparison/compare_c++20.cc [new file with mode: 0644]