libstdc++: Implement spaceship for std::pair (P1614R2)
authorJonathan Wakely <jwakely@redhat.com>
Tue, 3 Dec 2019 23:57:46 +0000 (23:57 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 3 Dec 2019 23:57:46 +0000 (23:57 +0000)
commit7f397e451905d1ce2b04d56836044b97d71216dd
treece0d178fc7667c837a673141f0558e50129ff32a
parent6fb3d28f13dfc2591690b6f66d350f651bae6726
libstdc++: Implement spaceship for std::pair (P1614R2)

This defines operator<=> as a non-member function template and does not
alter operator==. This contradicts the changes made by P1614R2, which
specify both as hidden friends, but that specification of operator<=> is
broken and the subject of a soon-to-be-published LWG issue.

* include/bits/stl_pair.h [__cpp_lib_three_way_comparison]
(operator<=>): Define for C++20.
* libsupc++/compare (__cmp2way_res_t): Rename to __cmp3way_res_t,
move into __detail namespace. Do not turn argument types into lvalues.
(__cmp3way_helper): Rename to __cmp3way_res_impl, move into __detail
namespace. Constrain with concepts instead of using void_t.
(compare_three_way_result): Adjust name of base class.
(compare_three_way_result_t): Use __cmp3way_res_impl directly.
(__detail::__3way_cmp_with): Add workaround for PR 91073.
(compare_three_way): Use workaround.
(__detail::__synth3way, __detail::__synth3way_t): Define new helpers
implementing synth-three-way and synth-three-way-result semantics.
* testsuite/20_util/pair/comparison_operators/constexpr_c++20.cc: New
test.

From-SVN: r278951
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_pair.h
libstdc++-v3/libsupc++/compare
libstdc++-v3/testsuite/20_util/pair/comparison_operators/constexpr_c++20.cc [new file with mode: 0644]