diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 3d0ddf5f36ebf5a2cfe47b0e92604293ad2e490a..7e6a010a4ab3e9569912747c46599829f1d1c63a 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,8 @@ 2020-04-20 Jonathan Wakely <jwakely@redhat.com> + * include/std/version (__cpp_lib_three_way_comparison): Update value. + * libsupc++/compare (__cpp_lib_three_way_comparison): Likewise. + * include/bits/stl_map.h (map): Define operator<=> and remove operator< for C++20. * include/bits/stl_multimap.h (multimap): Likewise. diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version index d9a47ee8e8a35f63ff9f5ca9b6c0338c8f0c9f2d..6d7dcc46023abce8fe78c7a11d9db95096cbdec4 100644 --- a/libstdc++-v3/include/std/version +++ b/libstdc++-v3/include/std/version @@ -200,7 +200,7 @@ #endif #define __cpp_lib_span 202002L #if __cpp_impl_three_way_comparison >= 201907L && __cpp_lib_concepts -# define __cpp_lib_three_way_comparison 201711L +# define __cpp_lib_three_way_comparison 201907L #endif #define __cpp_lib_to_array 201907L #endif diff --git a/libstdc++-v3/libsupc++/compare b/libstdc++-v3/libsupc++/compare index e5fb322ed9e1492db37070ada7c2ded825f905d9..28dfe843ee7c5e0bc6339b676593bcba679090dd 100644 --- a/libstdc++-v3/libsupc++/compare +++ b/libstdc++-v3/libsupc++/compare @@ -39,7 +39,7 @@ #include <concepts> #if __cpp_lib_concepts -# define __cpp_lib_three_way_comparison 201711L +# define __cpp_lib_three_way_comparison 201907L #endif namespace std @@ -866,12 +866,23 @@ namespace std namespace __detail { - // [expos.only.func] + // [expos.only.func] synth-three-way inline constexpr struct _Synth3way { + template<typename _Tp, typename _Up> + static constexpr bool + _S_noexcept(const _Tp* __t = nullptr, const _Up* __u = nullptr) + { + if constexpr (three_way_comparable_with<_Tp, _Up>) + return noexcept(*__t <=> *__u); + else + return noexcept(*__t < *__u) && noexcept(*__u < *__t); + } + template<typename _Tp, typename _Up> constexpr auto operator()(const _Tp& __t, const _Up& __u) const + noexcept(_S_noexcept<_Tp, _Up>()) requires requires { { __t < __u } -> __boolean_testable; @@ -892,6 +903,7 @@ namespace std } } __synth3way = {}; + // [expos.only.func] synth-three-way-result template<typename _Tp, typename _Up = _Tp> using __synth3way_t = decltype(__detail::__synth3way(std::declval<_Tp&>(),