diff --git a/libcxx/include/__chrono/day.h b/libcxx/include/__chrono/day.h --- a/libcxx/include/__chrono/day.h +++ b/libcxx/include/__chrono/day.h @@ -12,6 +12,7 @@ #include <__chrono/duration.h> #include <__config> +#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -45,25 +46,9 @@ bool operator==(const day& __lhs, const day& __rhs) noexcept { return static_cast(__lhs) == static_cast(__rhs); } -_LIBCPP_HIDE_FROM_ABI inline constexpr -bool operator!=(const day& __lhs, const day& __rhs) noexcept -{ return !(__lhs == __rhs); } - -_LIBCPP_HIDE_FROM_ABI inline constexpr -bool operator< (const day& __lhs, const day& __rhs) noexcept -{ return static_cast(__lhs) < static_cast(__rhs); } - -_LIBCPP_HIDE_FROM_ABI inline constexpr -bool operator> (const day& __lhs, const day& __rhs) noexcept -{ return __rhs < __lhs; } - -_LIBCPP_HIDE_FROM_ABI inline constexpr -bool operator<=(const day& __lhs, const day& __rhs) noexcept -{ return !(__rhs < __lhs);} - -_LIBCPP_HIDE_FROM_ABI inline constexpr -bool operator>=(const day& __lhs, const day& __rhs) noexcept -{ return !(__lhs < __rhs); } +_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(const day& __lhs, const day& __rhs) noexcept { + return static_cast(__lhs) <=> static_cast(__rhs); +} _LIBCPP_HIDE_FROM_ABI inline constexpr day operator+ (const day& __lhs, const days& __rhs) noexcept diff --git a/libcxx/include/chrono b/libcxx/include/chrono --- a/libcxx/include/chrono +++ b/libcxx/include/chrono @@ -13,6 +13,8 @@ /* chrono synopsis +#include // C++20 + namespace std { namespace chrono @@ -325,11 +327,7 @@ class day; constexpr bool operator==(const day& x, const day& y) noexcept; -constexpr bool operator!=(const day& x, const day& y) noexcept; -constexpr bool operator< (const day& x, const day& y) noexcept; -constexpr bool operator> (const day& x, const day& y) noexcept; -constexpr bool operator<=(const day& x, const day& y) noexcept; -constexpr bool operator>=(const day& x, const day& y) noexcept; +constexpr strong_ordering operator<=>(const day& x, const day& y) noexcept; constexpr day operator+(const day& x, const days& y) noexcept; constexpr day operator+(const days& x, const day& y) noexcept; constexpr day operator-(const day& x, const days& y) noexcept; @@ -715,9 +713,11 @@ #include <__chrono/year_month_day.h> #include <__chrono/year_month_weekday.h> #include <__config> -#include #include +// standard-mandated includes +#include + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/libcxx/test/std/containers/associative/map/map.nonmember/op_compare.pass.cpp b/libcxx/test/std/containers/associative/map/map.nonmember/op_compare.pass.cpp --- a/libcxx/test/std/containers/associative/map/map.nonmember/op_compare.pass.cpp +++ b/libcxx/test/std/containers/associative/map/map.nonmember/op_compare.pass.cpp @@ -46,28 +46,28 @@ m1.insert(value_type(1, "abc")); m2.insert(value_type(2, "abc")); const map_type& cm1 = m1, cm2 = m2; - assert(testComparisons6(cm1, cm2, false, true)); + assert(testComparisons(cm1, cm2, false, true)); } { map_type m1, m2; m1.insert(value_type(1, "abc")); m2.insert(value_type(1, "abc")); const map_type& cm1 = m1, cm2 = m2; - assert(testComparisons6(cm1, cm2, true, false)); + assert(testComparisons(cm1, cm2, true, false)); } { map_type m1, m2; m1.insert(value_type(1, "ab")); m2.insert(value_type(1, "abc")); const map_type& cm1 = m1, cm2 = m2; - assert(testComparisons6(cm1, cm2, false, true)); + assert(testComparisons(cm1, cm2, false, true)); } { map_type m1, m2; m1.insert(value_type(1, "abc")); m2.insert(value_type(1, "bcd")); const map_type& cm1 = m1, cm2 = m2; - assert(testComparisons6(cm1, cm2, false, true)); + assert(testComparisons(cm1, cm2, false, true)); } { map_type m1, m2; @@ -75,7 +75,7 @@ m2.insert(value_type(1, "abc")); m2.insert(value_type(2, "abc")); const map_type& cm1 = m1, cm2 = m2; - assert(testComparisons6(cm1, cm2, false, true)); + assert(testComparisons(cm1, cm2, false, true)); } return 0; } diff --git a/libcxx/test/std/containers/associative/multimap/multimap.nonmember/op_compare.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.nonmember/op_compare.pass.cpp --- a/libcxx/test/std/containers/associative/multimap/multimap.nonmember/op_compare.pass.cpp +++ b/libcxx/test/std/containers/associative/multimap/multimap.nonmember/op_compare.pass.cpp @@ -46,28 +46,28 @@ m1.insert(value_type(1, "abc")); m2.insert(value_type(2, "abc")); const map_type& cm1 = m1, cm2 = m2; - assert(testComparisons6(cm1, cm2, false, true)); + assert(testComparisons(cm1, cm2, false, true)); } { map_type m1, m2; m1.insert(value_type(1, "abc")); m2.insert(value_type(1, "abc")); const map_type& cm1 = m1, cm2 = m2; - assert(testComparisons6(cm1, cm2, true, false)); + assert(testComparisons(cm1, cm2, true, false)); } { map_type m1, m2; m1.insert(value_type(1, "ab")); m2.insert(value_type(1, "abc")); const map_type& cm1 = m1, cm2 = m2; - assert(testComparisons6(cm1, cm2, false, true)); + assert(testComparisons(cm1, cm2, false, true)); } { map_type m1, m2; m1.insert(value_type(1, "abc")); m2.insert(value_type(1, "bcd")); const map_type& cm1 = m1, cm2 = m2; - assert(testComparisons6(cm1, cm2, false, true)); + assert(testComparisons(cm1, cm2, false, true)); } { map_type m1, m2; @@ -75,7 +75,7 @@ m2.insert(value_type(1, "abc")); m2.insert(value_type(2, "abc")); const map_type& cm1 = m1, cm2 = m2; - assert(testComparisons6(cm1, cm2, false, true)); + assert(testComparisons(cm1, cm2, false, true)); } { map_type m1, m2; @@ -84,7 +84,7 @@ m2.insert(value_type(1, "abc")); m2.insert(value_type(1, "bcd")); const map_type& cm1 = m1, cm2 = m2; - assert(testComparisons6(cm1, cm2, false, true)); + assert(testComparisons(cm1, cm2, false, true)); } return 0; } diff --git a/libcxx/test/std/containers/associative/multiset/multiset.nonmember/op_compare.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.nonmember/op_compare.pass.cpp --- a/libcxx/test/std/containers/associative/multiset/multiset.nonmember/op_compare.pass.cpp +++ b/libcxx/test/std/containers/associative/multiset/multiset.nonmember/op_compare.pass.cpp @@ -44,14 +44,14 @@ s1.insert(1); s2.insert(2); const std::multiset& cs1 = s1, cs2 = s2; - assert(testComparisons6(cs1, cs2, false, true)); + assert(testComparisons(cs1, cs2, false, true)); } { std::multiset s1, s2; s1.insert(1); s2.insert(1); const std::multiset& cs1 = s1, cs2 = s2; - assert(testComparisons6(cs1, cs2, true, false)); + assert(testComparisons(cs1, cs2, true, false)); } { std::multiset s1, s2; @@ -59,7 +59,7 @@ s2.insert(1); s2.insert(2); const std::multiset& cs1 = s1, cs2 = s2; - assert(testComparisons6(cs1, cs2, false, true)); + assert(testComparisons(cs1, cs2, false, true)); } { std::multiset s1, s2; @@ -68,7 +68,7 @@ s2.insert(1); s2.insert(1); const std::multiset& cs1 = s1, cs2 = s2; - assert(testComparisons6(cs1, cs2, false, true)); + assert(testComparisons(cs1, cs2, false, true)); } return 0; } diff --git a/libcxx/test/std/containers/associative/set/set.nonmember/op_compare.pass.cpp b/libcxx/test/std/containers/associative/set/set.nonmember/op_compare.pass.cpp --- a/libcxx/test/std/containers/associative/set/set.nonmember/op_compare.pass.cpp +++ b/libcxx/test/std/containers/associative/set/set.nonmember/op_compare.pass.cpp @@ -44,14 +44,14 @@ s1.insert(1); s2.insert(2); const std::set& cs1 = s1, cs2 = s2; - assert(testComparisons6(cs1, cs2, false, true)); + assert(testComparisons(cs1, cs2, false, true)); } { std::set s1, s2; s1.insert(1); s2.insert(1); const std::set& cs1 = s1, cs2 = s2; - assert(testComparisons6(cs1, cs2, true, false)); + assert(testComparisons(cs1, cs2, true, false)); } { std::set s1, s2; @@ -59,7 +59,7 @@ s2.insert(1); s2.insert(2); const std::set& cs1 = s1, cs2 = s2; - assert(testComparisons6(cs1, cs2, false, true)); + assert(testComparisons(cs1, cs2, false, true)); } return 0; } diff --git a/libcxx/test/std/containers/sequences/array/compare.pass.cpp b/libcxx/test/std/containers/sequences/array/compare.pass.cpp --- a/libcxx/test/std/containers/sequences/array/compare.pass.cpp +++ b/libcxx/test/std/containers/sequences/array/compare.pass.cpp @@ -30,15 +30,15 @@ const C c2 = {1, 2, 3}; const C c3 = {3, 2, 1}; const C c4 = {1, 2, 1}; - assert(testComparisons6(c1, c2, true, false)); - assert(testComparisons6(c1, c3, false, true)); - assert(testComparisons6(c1, c4, false, false)); + assert(testComparisons(c1, c2, true, false)); + assert(testComparisons(c1, c3, false, true)); + assert(testComparisons(c1, c4, false, false)); } { typedef std::array C; const C c1 = {}; const C c2 = {}; - assert(testComparisons6(c1, c2, true, false)); + assert(testComparisons(c1, c2, true, false)); } { typedef std::array C; @@ -46,15 +46,15 @@ const C c2 = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(3)}; const C c3 = {LessAndEqComp(3), LessAndEqComp(2), LessAndEqComp(1)}; const C c4 = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(1)}; - assert(testComparisons6(c1, c2, true, false)); - assert(testComparisons6(c1, c3, false, true)); - assert(testComparisons6(c1, c4, false, false)); + assert(testComparisons(c1, c2, true, false)); + assert(testComparisons(c1, c3, false, true)); + assert(testComparisons(c1, c4, false, false)); } { typedef std::array C; const C c1 = {}; const C c2 = {}; - assert(testComparisons6(c1, c2, true, false)); + assert(testComparisons(c1, c2, true, false)); } return true; diff --git a/libcxx/test/std/containers/sequences/deque/compare.pass.cpp b/libcxx/test/std/containers/sequences/deque/compare.pass.cpp --- a/libcxx/test/std/containers/sequences/deque/compare.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/compare.pass.cpp @@ -41,78 +41,78 @@ { { const std::deque d1, d2; - assert(testComparisons6(d1, d2, true, false)); + assert(testComparisons(d1, d2, true, false)); } { const std::deque d1(1, 1), d2(1, 1); - assert(testComparisons6(d1, d2, true, false)); + assert(testComparisons(d1, d2, true, false)); } { int items[3] = {1, 2, 3}; const std::deque d1(items, items + 3); const std::deque d2(items, items + 3); - assert(testComparisons6(d1, d2, true, false)); + assert(testComparisons(d1, d2, true, false)); } { const std::deque d1(1, 1), d2; - assert(testComparisons6(d1, d2, false, false)); + assert(testComparisons(d1, d2, false, false)); } { const std::deque d1(1, 1), d2(1, 2); - assert(testComparisons6(d1, d2, false, true)); + assert(testComparisons(d1, d2, false, true)); } { int items1[2] = {1, 2}; int items2[2] = {1, 3}; const std::deque d1(items1, items1 + 2); const std::deque d2(items2, items2 + 2); - assert(testComparisons6(d1, d2, false, true)); + assert(testComparisons(d1, d2, false, true)); } { int items1[2] = {2, 2}; int items2[2] = {1, 3}; const std::deque d1(items1, items1 + 2); const std::deque d2(items2, items2 + 2); - assert(testComparisons6(d1, d2, false, false)); + assert(testComparisons(d1, d2, false, false)); } { const std::deque d1, d2; - assert(testComparisons6(d1, d2, true, false)); + assert(testComparisons(d1, d2, true, false)); } { const std::deque d1(1, LessAndEqComp(1)); const std::deque d2(1, LessAndEqComp(1)); - assert(testComparisons6(d1, d2, true, false)); + assert(testComparisons(d1, d2, true, false)); } { LessAndEqComp items[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(3)}; const std::deque d1(items, items + 3); const std::deque d2(items, items + 3); - assert(testComparisons6(d1, d2, true, false)); + assert(testComparisons(d1, d2, true, false)); } { const std::deque d1(1, LessAndEqComp(1)); const std::deque d2; - assert(testComparisons6(d1, d2, false, false)); + assert(testComparisons(d1, d2, false, false)); } { const std::deque d1(1, LessAndEqComp(1)); const std::deque d2(1, LessAndEqComp(2)); - assert(testComparisons6(d1, d2, false, true)); + assert(testComparisons(d1, d2, false, true)); } { LessAndEqComp items1[2] = {LessAndEqComp(1), LessAndEqComp(2)}; LessAndEqComp items2[2] = {LessAndEqComp(1), LessAndEqComp(3)}; const std::deque d1(items1, items1 + 2); const std::deque d2(items2, items2 + 2); - assert(testComparisons6(d1, d2, false, true)); + assert(testComparisons(d1, d2, false, true)); } { LessAndEqComp items1[2] = {LessAndEqComp(2), LessAndEqComp(2)}; LessAndEqComp items2[2] = {LessAndEqComp(1), LessAndEqComp(3)}; const std::deque d1(items1, items1 + 2); const std::deque d2(items2, items2 + 2); - assert(testComparisons6(d1, d2, false, false)); + assert(testComparisons(d1, d2, false, false)); } return 0; diff --git a/libcxx/test/std/containers/sequences/list/compare.pass.cpp b/libcxx/test/std/containers/sequences/list/compare.pass.cpp --- a/libcxx/test/std/containers/sequences/list/compare.pass.cpp +++ b/libcxx/test/std/containers/sequences/list/compare.pass.cpp @@ -40,78 +40,78 @@ int main(int, char**) { { const std::list l1, l2; - assert(testComparisons6(l1, l2, true, false)); + assert(testComparisons(l1, l2, true, false)); } { const std::list l1(1, 1), l2(1, 1); - assert(testComparisons6(l1, l2, true, false)); + assert(testComparisons(l1, l2, true, false)); } { int items[3] = {1, 2, 3}; const std::list l1(items, items + 3); const std::list l2(items, items + 3); - assert(testComparisons6(l1, l2, true, false)); + assert(testComparisons(l1, l2, true, false)); } { const std::list l1(1, 1), l2; - assert(testComparisons6(l1, l2, false, false)); + assert(testComparisons(l1, l2, false, false)); } { const std::list l1(1, 1), l2(1, 2); - assert(testComparisons6(l1, l2, false, true)); + assert(testComparisons(l1, l2, false, true)); } { int items1[2] = {1, 2}; int items2[2] = {1, 3}; const std::list l1(items1, items1 + 2); const std::list l2(items2, items2 + 2); - assert(testComparisons6(l1, l2, false, true)); + assert(testComparisons(l1, l2, false, true)); } { int items1[2] = {2, 2}; int items2[2] = {1, 3}; const std::list l1(items1, items1 + 2); const std::list l2(items2, items2 + 2); - assert(testComparisons6(l1, l2, false, false)); + assert(testComparisons(l1, l2, false, false)); } { const std::list l1, l2; - assert(testComparisons6(l1, l2, true, false)); + assert(testComparisons(l1, l2, true, false)); } { const std::list l1(1, LessAndEqComp(1)); const std::list l2(1, LessAndEqComp(1)); - assert(testComparisons6(l1, l2, true, false)); + assert(testComparisons(l1, l2, true, false)); } { LessAndEqComp items[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(3)}; const std::list l1(items, items + 3); const std::list l2(items, items + 3); - assert(testComparisons6(l1, l2, true, false)); + assert(testComparisons(l1, l2, true, false)); } { const std::list l1(1, LessAndEqComp(1)); const std::list l2; - assert(testComparisons6(l1, l2, false, false)); + assert(testComparisons(l1, l2, false, false)); } { const std::list l1(1, LessAndEqComp(1)); const std::list l2(1, LessAndEqComp(2)); - assert(testComparisons6(l1, l2, false, true)); + assert(testComparisons(l1, l2, false, true)); } { LessAndEqComp items1[2] = {LessAndEqComp(1), LessAndEqComp(2)}; LessAndEqComp items2[2] = {LessAndEqComp(1), LessAndEqComp(3)}; const std::list l1(items1, items1 + 2); const std::list l2(items2, items2 + 2); - assert(testComparisons6(l1, l2, false, true)); + assert(testComparisons(l1, l2, false, true)); } { LessAndEqComp items1[2] = {LessAndEqComp(2), LessAndEqComp(2)}; LessAndEqComp items2[2] = {LessAndEqComp(1), LessAndEqComp(3)}; const std::list l1(items1, items1 + 2); const std::list l2(items2, items2 + 2); - assert(testComparisons6(l1, l2, false, false)); + assert(testComparisons(l1, l2, false, false)); } return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/compare.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/compare.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/compare.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/compare.pass.cpp @@ -24,48 +24,48 @@ typedef std::vector VB; { const VB v1, v2; - assert(testComparisons6(v1, v2, true, false)); + assert(testComparisons(v1, v2, true, false)); } { const VB v1(1, true); const VB v2(1, true); - assert(testComparisons6(v1, v2, true, false)); + assert(testComparisons(v1, v2, true, false)); } { const VB v1(1, false); const VB v2(1, true); - assert(testComparisons6(v1, v2, false, true)); + assert(testComparisons(v1, v2, false, true)); } { const VB v1, v2(1, true); - assert(testComparisons6(v1, v2, false, true)); + assert(testComparisons(v1, v2, false, true)); } { bool items1[3] = {false, true, false}; bool items2[3] = {false, true, true}; const VB v1(items1, items1 + 3); const VB v2(items2, items2 + 3); - assert(testComparisons6(v1, v2, false, true)); + assert(testComparisons(v1, v2, false, true)); } { bool items1[3] = {false, false, false}; bool items2[3] = {false, true, false}; const VB v1(items1, items1 + 3); const VB v2(items2, items2 + 3); - assert(testComparisons6(v1, v2, false, true)); + assert(testComparisons(v1, v2, false, true)); } { bool items1[2] = {false, true}; bool items2[3] = {false, true, false}; const VB v1(items1, items1 + 2); const VB v2(items2, items2 + 3); - assert(testComparisons6(v1, v2, false, true)); + assert(testComparisons(v1, v2, false, true)); } { bool items[3] = {false, true, false}; const VB v1(items, items + 3); const VB v2(1, true); - assert(testComparisons6(v1, v2, false, true)); + assert(testComparisons(v1, v2, false, true)); } { assert( (std::vector() == std::vector())); diff --git a/libcxx/test/std/containers/sequences/vector/compare.pass.cpp b/libcxx/test/std/containers/sequences/vector/compare.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/compare.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/compare.pass.cpp @@ -23,22 +23,22 @@ int main(int, char**) { { const std::vector c1, c2; - assert(testComparisons6(c1, c2, true, false)); + assert(testComparisons(c1, c2, true, false)); } { const std::vector c1(1, 1), c2(1, 2); - assert(testComparisons6(c1, c2, false, true)); + assert(testComparisons(c1, c2, false, true)); } { const std::vector c1, c2(1, 2); - assert(testComparisons6(c1, c2, false, true)); + assert(testComparisons(c1, c2, false, true)); } { int items1[3] = {1, 2, 1}; int items2[3] = {1, 2, 2}; const std::vector c1(items1, items1 + 3); const std::vector c2(items2, items2 + 3); - assert(testComparisons6(c1, c2, false, true)); + assert(testComparisons(c1, c2, false, true)); } { int items1[3] = {3, 2, 3}; @@ -46,66 +46,66 @@ const std::vector c1(items1, items1 + 3); const std::vector c2(items2, items2 + 3); - assert(testComparisons6(c1, c2, false, false)); + assert(testComparisons(c1, c2, false, false)); } { int items1[2] = {1, 2}; int items2[3] = {1, 2, 0}; const std::vector c1(items1, items1 + 2); const std::vector c2(items2, items2 + 3); - assert(testComparisons6(c1, c2, false, true)); + assert(testComparisons(c1, c2, false, true)); } { int items1[3] = {1, 2, 0}; const std::vector c1(items1, items1 + 3); const std::vector c2(1, 3); - assert(testComparisons6(c1, c2, false, true)); + assert(testComparisons(c1, c2, false, true)); } { const std::vector c1, c2; - assert(testComparisons6(c1, c2, true, false)); + assert(testComparisons(c1, c2, true, false)); } { const std::vector c1(1, LessAndEqComp(1)); const std::vector c2(1, LessAndEqComp(1)); - assert(testComparisons6(c1, c2, true, false)); + assert(testComparisons(c1, c2, true, false)); } { const std::vector c1(1, LessAndEqComp(1)); const std::vector c2(1, LessAndEqComp(2)); - assert(testComparisons6(c1, c2, false, true)); + assert(testComparisons(c1, c2, false, true)); } { const std::vector c1; const std::vector c2(1, LessAndEqComp(2)); - assert(testComparisons6(c1, c2, false, true)); + assert(testComparisons(c1, c2, false, true)); } { LessAndEqComp items1[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(2)}; LessAndEqComp items2[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(1)}; const std::vector c1(items1, items1 + 3); const std::vector c2(items2, items2 + 3); - assert(testComparisons6(c1, c2, false, false)); + assert(testComparisons(c1, c2, false, false)); } { LessAndEqComp items1[3] = {LessAndEqComp(3), LessAndEqComp(3), LessAndEqComp(3)}; LessAndEqComp items2[3] = {LessAndEqComp(3), LessAndEqComp(2), LessAndEqComp(3)}; const std::vector c1(items1, items1 + 3); const std::vector c2(items2, items2 + 3); - assert(testComparisons6(c1, c2, false, false)); + assert(testComparisons(c1, c2, false, false)); } { LessAndEqComp items1[2] = {LessAndEqComp(1), LessAndEqComp(2)}; LessAndEqComp items2[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(0)}; const std::vector c1(items1, items1 + 2); const std::vector c2(items2, items2 + 3); - assert(testComparisons6(c1, c2, false, true)); + assert(testComparisons(c1, c2, false, true)); } { LessAndEqComp items1[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(0)}; const std::vector c1(items1, items1 + 3); const std::vector c2(1, LessAndEqComp(3)); - assert(testComparisons6(c1, c2, false, true)); + assert(testComparisons(c1, c2, false, true)); } { assert((std::vector() == std::vector())); diff --git a/libcxx/test/std/containers/unord/unord.map/eq.pass.cpp b/libcxx/test/std/containers/unord/unord.map/eq.pass.cpp --- a/libcxx/test/std/containers/unord/unord.map/eq.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.map/eq.pass.cpp @@ -46,7 +46,7 @@ }; const C c1(std::begin(a), std::end(a)); const C c2; - assert(testComparisons2(c1, c2, false)); + assert(testEquality(c1, c2, false)); } { typedef std::unordered_map C; @@ -64,7 +64,7 @@ }; const C c1(std::begin(a), std::end(a)); const C c2 = c1; - assert(testComparisons2(c1, c2, true)); + assert(testEquality(c1, c2, true)); } { typedef std::unordered_map C; @@ -83,11 +83,11 @@ C c1(std::begin(a), std::end(a)); C c2 = c1; c2.rehash(30); - assert(testComparisons2(c1, c2, true)); + assert(testEquality(c1, c2, true)); c2.insert(P(90, "ninety")); - assert(testComparisons2(c1, c2, false)); + assert(testEquality(c1, c2, false)); c1.insert(P(90, "ninety")); - assert(testComparisons2(c1, c2, true)); + assert(testEquality(c1, c2, true)); } { typedef std::unordered_map C; @@ -105,10 +105,10 @@ }; C c1(std::begin(a), std::end(a)); C c2 = c1; - assert(testComparisons2(c1, c2, true)); + assert(testEquality(c1, c2, true)); c1.insert(P(90, "ninety")); c2.insert(P(100, "onehundred")); - assert(testComparisons2(c1, c2, false)); + assert(testEquality(c1, c2, false)); } #if TEST_STD_VER >= 11 { @@ -128,7 +128,7 @@ }; const C c1(std::begin(a), std::end(a)); const C c2; - assert(testComparisons2(c1, c2, false)); + assert(testEquality(c1, c2, false)); } { typedef std::unordered_map, std::equal_to, @@ -147,7 +147,7 @@ }; const C c1(std::begin(a), std::end(a)); const C c2 = c1; - assert(testComparisons2(c1, c2, true)); + assert(testEquality(c1, c2, true)); } { typedef std::unordered_map, std::equal_to, @@ -167,11 +167,11 @@ C c1(std::begin(a), std::end(a)); C c2 = c1; c2.rehash(30); - assert(testComparisons2(c1, c2, true)); + assert(testEquality(c1, c2, true)); c2.insert(P(90, "ninety")); - assert(testComparisons2(c1, c2, false)); + assert(testEquality(c1, c2, false)); c1.insert(P(90, "ninety")); - assert(testComparisons2(c1, c2, true)); + assert(testEquality(c1, c2, true)); } { typedef std::unordered_map, std::equal_to, @@ -190,10 +190,10 @@ }; C c1(std::begin(a), std::end(a)); C c2 = c1; - assert(testComparisons2(c1, c2, true)); + assert(testEquality(c1, c2, true)); c1.insert(P(90, "ninety")); c2.insert(P(100, "onehundred")); - assert(testComparisons2(c1, c2, false)); + assert(testEquality(c1, c2, false)); } #endif diff --git a/libcxx/test/std/containers/unord/unord.multimap/eq.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/eq.pass.cpp --- a/libcxx/test/std/containers/unord/unord.multimap/eq.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.multimap/eq.pass.cpp @@ -49,7 +49,7 @@ }; const C c1(std::begin(a), std::end(a)); const C c2; - assert(testComparisons2(c1, c2, false)); + assert(testEquality(c1, c2, false)); } { typedef std::unordered_multimap C; @@ -70,7 +70,7 @@ }; const C c1(std::begin(a), std::end(a)); const C c2 = c1; - assert(testComparisons2(c1, c2, true)); + assert(testEquality(c1, c2, true)); } { typedef std::unordered_multimap C; @@ -92,11 +92,11 @@ C c1(std::begin(a), std::end(a)); C c2 = c1; c2.rehash(30); - assert(testComparisons2(c1, c2, true)); + assert(testEquality(c1, c2, true)); c2.insert(P(90, "ninety")); - assert(testComparisons2(c1, c2, false)); + assert(testEquality(c1, c2, false)); c1.insert(P(90, "ninety")); - assert(testComparisons2(c1, c2, true)); + assert(testEquality(c1, c2, true)); } { typedef std::unordered_multimap C; @@ -117,10 +117,10 @@ }; C c1(std::begin(a), std::end(a)); C c2 = c1; - assert(testComparisons2(c1, c2, true)); + assert(testEquality(c1, c2, true)); c1.insert(P(70, "seventy 2")); c2.insert(P(80, "eighty 2")); - assert(testComparisons2(c1, c2, false)); + assert(testEquality(c1, c2, false)); } #if TEST_STD_VER >= 11 { @@ -143,7 +143,7 @@ }; const C c1(std::begin(a), std::end(a)); const C c2; - assert(testComparisons2(c1, c2, false)); + assert(testEquality(c1, c2, false)); } { typedef std::unordered_multimap, std::equal_to, @@ -165,7 +165,7 @@ }; const C c1(std::begin(a), std::end(a)); const C c2 = c1; - assert(testComparisons2(c1, c2, true)); + assert(testEquality(c1, c2, true)); } { typedef std::unordered_multimap, std::equal_to, @@ -188,11 +188,11 @@ C c1(std::begin(a), std::end(a)); C c2 = c1; c2.rehash(30); - assert(testComparisons2(c1, c2, true)); + assert(testEquality(c1, c2, true)); c2.insert(P(90, "ninety")); - assert(testComparisons2(c1, c2, false)); + assert(testEquality(c1, c2, false)); c1.insert(P(90, "ninety")); - assert(testComparisons2(c1, c2, true)); + assert(testEquality(c1, c2, true)); } { typedef std::unordered_multimap, std::equal_to, @@ -214,10 +214,10 @@ }; C c1(std::begin(a), std::end(a)); C c2 = c1; - assert(testComparisons2(c1, c2, true)); + assert(testEquality(c1, c2, true)); c1.insert(P(70, "seventy 2")); c2.insert(P(80, "eighty 2")); - assert(testComparisons2(c1, c2, false)); + assert(testEquality(c1, c2, false)); } #endif diff --git a/libcxx/test/std/time/time.cal/time.cal.day/time.cal.day.nonmembers/comparisons.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.day/time.cal.day.nonmembers/comparisons.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.day/time.cal.day.nonmembers/comparisons.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.day/time.cal.day.nonmembers/comparisons.pass.cpp @@ -12,9 +12,8 @@ // constexpr bool operator==(const day& x, const day& y) noexcept; // Returns: unsigned{x} == unsigned{y}. -// constexpr bool operator<(const day& x, const day& y) noexcept; -// Returns: unsigned{x} < unsigned{y}. - +// constexpr strong_ordering operator<=>(const day& x, const day& y) noexcept; +// Returns: unsigned{x} <=> unsigned{y}. #include #include @@ -23,23 +22,30 @@ #include "test_macros.h" #include "test_comparisons.h" -int main(int, char**) -{ - using day = std::chrono::day; +constexpr bool test() { + using day = std::chrono::day; + + // Validate invalid values. The range [0, 255] is guaranteed to be allowed. + assert(testOrderValues(0U, 0U)); + assert(testOrderValues(0U, 1U)); + assert(testOrderValues(254U, 255U)); + assert(testOrderValues(255U, 255U)); - AssertComparisons6AreNoexcept(); - AssertComparisons6ReturnBool(); + // Validate some valid values. + for (unsigned i = 1; i < 10; ++i) + for (unsigned j = 1; j < 10; ++j) + assert(testOrderValues(i, j)); - static_assert(testComparisons6Values(0U, 0U), ""); - static_assert(testComparisons6Values(0U, 1U), ""); + return true; +} - // Some 'ok' values as well - static_assert(testComparisons6Values( 5U, 5U), ""); - static_assert(testComparisons6Values( 5U, 10U), ""); +int main(int, char**) { + using day = std::chrono::day; + AssertOrderAreNoexcept(); + AssertOrderReturn(); - for (unsigned i = 1; i < 10; ++i) - for (unsigned j = 1; j < 10; ++j) - assert(testComparisons6Values(i, j)); + test(); + static_assert(test()); return 0; } diff --git a/libcxx/test/std/time/time.cal/time.cal.md/time.cal.md.nonmembers/comparisons.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.md/time.cal.md.nonmembers/comparisons.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.md/time.cal.md.nonmembers/comparisons.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.md/time.cal.md.nonmembers/comparisons.pass.cpp @@ -32,20 +32,20 @@ using month = std::chrono::month; using month_day = std::chrono::month_day; - AssertComparisons6AreNoexcept(); - AssertComparisons6ReturnBool(); + AssertComparisonsAreNoexcept(); + AssertComparisonsReturnBool(); - static_assert( testComparisons6( + static_assert( testComparisons( month_day{std::chrono::January, day{1}}, month_day{std::chrono::January, day{1}}, true, false), ""); - static_assert( testComparisons6( + static_assert( testComparisons( month_day{std::chrono::January, day{1}}, month_day{std::chrono::January, day{2}}, false, true), ""); - static_assert( testComparisons6( + static_assert( testComparisons( month_day{std::chrono::January, day{1}}, month_day{std::chrono::February, day{1}}, false, true), ""); @@ -53,7 +53,7 @@ // same day, different months for (unsigned i = 1; i < 12; ++i) for (unsigned j = 1; j < 12; ++j) - assert((testComparisons6( + assert((testComparisons( month_day{month{i}, day{1}}, month_day{month{j}, day{1}}, i == j, i < j ))); @@ -61,7 +61,7 @@ // same month, different days for (unsigned i = 1; i < 31; ++i) for (unsigned j = 1; j < 31; ++j) - assert((testComparisons6( + assert((testComparisons( month_day{month{2}, day{i}}, month_day{month{2}, day{j}}, i == j, i < j ))); diff --git a/libcxx/test/std/time/time.cal/time.cal.mdlast/comparisons.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.mdlast/comparisons.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.mdlast/comparisons.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.mdlast/comparisons.pass.cpp @@ -29,16 +29,16 @@ using month = std::chrono::month; using month_day_last = std::chrono::month_day_last; - AssertComparisons6AreNoexcept(); - AssertComparisons6ReturnBool(); + AssertComparisonsAreNoexcept(); + AssertComparisonsReturnBool(); - static_assert( testComparisons6Values(month{1}, month{1}), ""); - static_assert( testComparisons6Values(month{1}, month{2}), ""); + static_assert( testComparisonsValues(month{1}, month{1}), ""); + static_assert( testComparisonsValues(month{1}, month{2}), ""); // same day, different months for (unsigned i = 1; i <= 12; ++i) for (unsigned j = 1; j <= 12; ++j) - assert(testComparisons6Values(month{i}, month{j})); + assert(testComparisonsValues(month{i}, month{j})); return 0; } diff --git a/libcxx/test/std/time/time.cal/time.cal.month/time.cal.month.nonmembers/comparisons.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.month/time.cal.month.nonmembers/comparisons.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.month/time.cal.month.nonmembers/comparisons.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.month/time.cal.month.nonmembers/comparisons.pass.cpp @@ -30,19 +30,19 @@ { using month = std::chrono::month; - AssertComparisons6AreNoexcept(); - AssertComparisons6ReturnBool(); + AssertComparisonsAreNoexcept(); + AssertComparisonsReturnBool(); - static_assert(testComparisons6Values(0U ,0U), ""); - static_assert(testComparisons6Values(0U, 1U), ""); + static_assert(testComparisonsValues(0U ,0U), ""); + static_assert(testComparisonsValues(0U, 1U), ""); // Some 'ok' values as well - static_assert(testComparisons6Values( 5U, 5U), ""); - static_assert(testComparisons6Values( 5U, 10U), ""); + static_assert(testComparisonsValues( 5U, 5U), ""); + static_assert(testComparisonsValues( 5U, 10U), ""); for (unsigned i = 1; i <= 12; ++i) for (unsigned j = 1; j <= 12; ++j) - assert(testComparisons6Values(i, j)); + assert(testComparisonsValues(i, j)); return 0; } diff --git a/libcxx/test/std/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/comparisons.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/comparisons.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/comparisons.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/comparisons.pass.cpp @@ -31,30 +31,30 @@ constexpr weekday Sunday = std::chrono::Sunday; constexpr weekday Monday = std::chrono::Monday; - AssertComparisons2AreNoexcept(); - AssertComparisons2ReturnBool(); + AssertEqualityAreNoexcept(); + AssertEqualityReturnBool(); - static_assert( testComparisons2( + static_assert( testEquality( month_weekday{std::chrono::January, weekday_indexed{Sunday, 1}}, month_weekday{std::chrono::January, weekday_indexed{Sunday, 1}}, true), ""); - static_assert( testComparisons2( + static_assert( testEquality( month_weekday{std::chrono::January, weekday_indexed{Sunday, 1}}, month_weekday{std::chrono::January, weekday_indexed{Sunday, 2}}, false), ""); - static_assert( testComparisons2( + static_assert( testEquality( month_weekday{std::chrono::January, weekday_indexed{Sunday, 1}}, month_weekday{std::chrono::February, weekday_indexed{Sunday, 1}}, false), ""); - static_assert( testComparisons2( + static_assert( testEquality( month_weekday{std::chrono::January, weekday_indexed{Monday, 1}}, month_weekday{std::chrono::January, weekday_indexed{Sunday, 2}}, false), ""); - static_assert( testComparisons2( + static_assert( testEquality( month_weekday{std::chrono::January, weekday_indexed{Monday, 1}}, month_weekday{std::chrono::February, weekday_indexed{Sunday, 1}}, false), ""); @@ -62,7 +62,7 @@ // same day, different months for (unsigned i = 1; i < 12; ++i) for (unsigned j = 1; j < 12; ++j) - assert((testComparisons2( + assert((testEquality( month_weekday{month{i}, weekday_indexed{Sunday, 1}}, month_weekday{month{j}, weekday_indexed{Sunday, 1}}, i == j))); @@ -70,7 +70,7 @@ // same month, different weeks for (unsigned i = 1; i < 5; ++i) for (unsigned j = 1; j < 5; ++j) - assert((testComparisons2( + assert((testEquality( month_weekday{month{2}, weekday_indexed{Sunday, i}}, month_weekday{month{2}, weekday_indexed{Sunday, j}}, i == j))); @@ -78,7 +78,7 @@ // same month, different days for (unsigned i = 0; i < 6; ++i) for (unsigned j = 0; j < 6; ++j) - assert((testComparisons2( + assert((testEquality( month_weekday{month{2}, weekday_indexed{weekday{i}, 2}}, month_weekday{month{2}, weekday_indexed{weekday{j}, 2}}, i == j))); diff --git a/libcxx/test/std/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/comparisons.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/comparisons.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/comparisons.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/comparisons.pass.cpp @@ -35,15 +35,15 @@ constexpr weekday Tuesday = std::chrono::Tuesday; constexpr weekday Wednesday = std::chrono::Wednesday; - AssertComparisons2AreNoexcept(); - AssertComparisons2ReturnBool(); + AssertEqualityAreNoexcept(); + AssertEqualityReturnBool(); - static_assert( testComparisons2( + static_assert( testEquality( month_weekday_last{std::chrono::January, weekday_last{Tuesday}}, month_weekday_last{std::chrono::January, weekday_last{Tuesday}}, true), ""); - static_assert( testComparisons2( + static_assert( testEquality( month_weekday_last{std::chrono::January, weekday_last{Tuesday}}, month_weekday_last{std::chrono::January, weekday_last{Wednesday}}, false), ""); @@ -51,7 +51,7 @@ // vary the months for (unsigned i = 1; i < 12; ++i) for (unsigned j = 1; j < 12; ++j) - assert((testComparisons2( + assert((testEquality( month_weekday_last{month{i}, weekday_last{Tuesday}}, month_weekday_last{month{j}, weekday_last{Tuesday}}, i == j))); @@ -59,13 +59,13 @@ // vary the weekday for (unsigned i = 0; i < 6; ++i) for (unsigned j = 0; j < 6; ++j) - assert((testComparisons2( + assert((testEquality( month_weekday_last{January, weekday_last{weekday{i}}}, month_weekday_last{January, weekday_last{weekday{j}}}, i == j))); // both different - assert((testComparisons2( + assert((testEquality( month_weekday_last{month{1}, weekday_last{weekday{1}}}, month_weekday_last{month{2}, weekday_last{weekday{2}}}, false))); diff --git a/libcxx/test/std/time/time.cal/time.cal.operators/month_day.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.operators/month_day.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.operators/month_day.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.operators/month_day.pass.cpp @@ -36,7 +36,6 @@ #include #include "test_macros.h" -#include "test_comparisons.h" int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.operators/month_day_last.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.operators/month_day_last.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.operators/month_day_last.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.operators/month_day_last.pass.cpp @@ -39,7 +39,6 @@ #include #include "test_macros.h" -#include "test_comparisons.h" int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.operators/month_weekday.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.operators/month_weekday.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.operators/month_weekday.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.operators/month_weekday.pass.cpp @@ -42,7 +42,6 @@ #include #include "test_macros.h" -#include "test_comparisons.h" int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.operators/month_weekday_last.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.operators/month_weekday_last.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.operators/month_weekday_last.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.operators/month_weekday_last.pass.cpp @@ -34,7 +34,6 @@ #include #include "test_macros.h" -#include "test_comparisons.h" int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.operators/year_month.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.operators/year_month.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.operators/year_month.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.operators/year_month.pass.cpp @@ -23,7 +23,6 @@ #include #include "test_macros.h" -#include "test_comparisons.h" int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.operators/year_month_day.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.operators/year_month_day.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.operators/year_month_day.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.operators/year_month_day.pass.cpp @@ -40,7 +40,6 @@ #include #include "test_macros.h" -#include "test_comparisons.h" int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.operators/year_month_day_last.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.operators/year_month_day_last.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.operators/year_month_day_last.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.operators/year_month_day_last.pass.cpp @@ -36,7 +36,6 @@ #include #include "test_macros.h" -#include "test_comparisons.h" int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.operators/year_month_weekday.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.operators/year_month_weekday.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.operators/year_month_weekday.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.operators/year_month_weekday.pass.cpp @@ -35,7 +35,6 @@ #include #include "test_macros.h" -#include "test_comparisons.h" int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.operators/year_month_weekday_last.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.operators/year_month_weekday_last.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.operators/year_month_weekday_last.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.operators/year_month_weekday_last.pass.cpp @@ -37,7 +37,6 @@ #include #include "test_macros.h" -#include "test_comparisons.h" int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/comparisons.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/comparisons.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/comparisons.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/comparisons.pass.cpp @@ -27,8 +27,8 @@ using weekday = std::chrono::weekday; using weekday_indexed = std::chrono::weekday_indexed; - AssertComparisons2AreNoexcept(); - AssertComparisons2ReturnBool(); + AssertEqualityAreNoexcept(); + AssertEqualityReturnBool(); static_assert( (weekday_indexed{} == weekday_indexed{}), ""); static_assert(!(weekday_indexed{} != weekday_indexed{}), ""); diff --git a/libcxx/test/std/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/comparisons.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/comparisons.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/comparisons.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/comparisons.pass.cpp @@ -26,19 +26,19 @@ using weekday = std::chrono::weekday; using weekday_last = std::chrono::weekday_last; - AssertComparisons2AreNoexcept(); - AssertComparisons2ReturnBool(); + AssertEqualityAreNoexcept(); + AssertEqualityReturnBool(); - static_assert(testComparisons2Values(weekday{0}, weekday{0}), ""); - static_assert(testComparisons2Values(weekday{0}, weekday{1}), ""); + static_assert(testEqualityValues(weekday{0}, weekday{0}), ""); + static_assert(testEqualityValues(weekday{0}, weekday{1}), ""); // Some 'ok' values as well - static_assert(testComparisons2Values(weekday{2}, weekday{2}), ""); - static_assert(testComparisons2Values(weekday{2}, weekday{3}), ""); + static_assert(testEqualityValues(weekday{2}, weekday{2}), ""); + static_assert(testEqualityValues(weekday{2}, weekday{3}), ""); for (unsigned i = 0; i < 6; ++i) for (unsigned j = 0; j < 6; ++j) - assert(testComparisons2Values(weekday{i}, weekday{j})); + assert(testEqualityValues(weekday{i}, weekday{j})); return 0; } diff --git a/libcxx/test/std/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/comparisons.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/comparisons.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/comparisons.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/comparisons.pass.cpp @@ -25,19 +25,19 @@ { using weekday = std::chrono::weekday; - AssertComparisons2AreNoexcept(); - AssertComparisons2ReturnBool(); + AssertEqualityAreNoexcept(); + AssertEqualityReturnBool(); - static_assert(testComparisons2Values(0U ,0U), ""); - static_assert(testComparisons2Values(0U, 1U), ""); + static_assert(testEqualityValues(0U ,0U), ""); + static_assert(testEqualityValues(0U, 1U), ""); // Some 'ok' values as well - static_assert(testComparisons2Values(5U, 5U), ""); - static_assert(testComparisons2Values(5U, 2U), ""); + static_assert(testEqualityValues(5U, 5U), ""); + static_assert(testEqualityValues(5U, 2U), ""); for (unsigned i = 0; i < 6; ++i) for (unsigned j = 0; j < 6; ++j) - assert(testComparisons2Values(i, j)); + assert(testEqualityValues(i, j)); return 0; } diff --git a/libcxx/test/std/time/time.cal/time.cal.year/time.cal.year.nonmembers/comparisons.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.year/time.cal.year.nonmembers/comparisons.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.year/time.cal.year.nonmembers/comparisons.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.year/time.cal.year.nonmembers/comparisons.pass.cpp @@ -30,19 +30,19 @@ { using year = std::chrono::year; - AssertComparisons6AreNoexcept(); - AssertComparisons6ReturnBool(); + AssertComparisonsAreNoexcept(); + AssertComparisonsReturnBool(); - static_assert(testComparisons6Values(0,0), ""); - static_assert(testComparisons6Values(0,1), ""); + static_assert(testComparisonsValues(0,0), ""); + static_assert(testComparisonsValues(0,1), ""); // Some 'ok' values as well - static_assert(testComparisons6Values( 5, 5), ""); - static_assert(testComparisons6Values( 5,10), ""); + static_assert(testComparisonsValues( 5, 5), ""); + static_assert(testComparisonsValues( 5,10), ""); for (int i = 1; i < 10; ++i) for (int j = 1; j < 10; ++j) - assert(testComparisons6Values(i, j)); + assert(testComparisonsValues(i, j)); return 0; } diff --git a/libcxx/test/std/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/comparisons.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/comparisons.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/comparisons.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/comparisons.pass.cpp @@ -32,20 +32,20 @@ using month = std::chrono::month; using year_month = std::chrono::year_month; - AssertComparisons6AreNoexcept(); - AssertComparisons6ReturnBool(); + AssertComparisonsAreNoexcept(); + AssertComparisonsReturnBool(); - static_assert( testComparisons6( + static_assert( testComparisons( year_month{year{1234}, std::chrono::January}, year_month{year{1234}, std::chrono::January}, true, false), ""); - static_assert( testComparisons6( + static_assert( testComparisons( year_month{year{1234}, std::chrono::January}, year_month{year{1234}, std::chrono::February}, false, true), ""); - static_assert( testComparisons6( + static_assert( testComparisons( year_month{year{1234}, std::chrono::January}, year_month{year{1235}, std::chrono::January}, false, true), ""); @@ -53,7 +53,7 @@ // same year, different months for (unsigned i = 1; i < 12; ++i) for (unsigned j = 1; j < 12; ++j) - assert((testComparisons6( + assert((testComparisons( year_month{year{1234}, month{i}}, year_month{year{1234}, month{j}}, i == j, i < j ))); @@ -61,7 +61,7 @@ // same month, different years for (int i = 1000; i < 2000; ++i) for (int j = 1000; j < 2000; ++j) - assert((testComparisons6( + assert((testComparisons( year_month{year{i}, std::chrono::January}, year_month{year{j}, std::chrono::January}, i == j, i < j ))); diff --git a/libcxx/test/std/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/comparisons.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/comparisons.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/comparisons.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/comparisons.pass.cpp @@ -36,56 +36,56 @@ using month = std::chrono::month; using year_month_day = std::chrono::year_month_day; - AssertComparisons6AreNoexcept(); - AssertComparisons6ReturnBool(); + AssertComparisonsAreNoexcept(); + AssertComparisonsReturnBool(); constexpr month January = std::chrono::January; constexpr month February = std::chrono::February; - static_assert( testComparisons6( + static_assert( testComparisons( year_month_day{year{1234}, January, day{1}}, year_month_day{year{1234}, January, day{1}}, true, false), ""); // different day - static_assert( testComparisons6( + static_assert( testComparisons( year_month_day{year{1234}, January, day{1}}, year_month_day{year{1234}, January, day{2}}, false, true), ""); // different month - static_assert( testComparisons6( + static_assert( testComparisons( year_month_day{year{1234}, January, day{1}}, year_month_day{year{1234}, February, day{1}}, false, true), ""); // different year - static_assert( testComparisons6( + static_assert( testComparisons( year_month_day{year{1234}, January, day{1}}, year_month_day{year{1235}, January, day{1}}, false, true), ""); // different month and day - static_assert( testComparisons6( + static_assert( testComparisons( year_month_day{year{1234}, January, day{2}}, year_month_day{year{1234}, February, day{1}}, false, true), ""); // different year and month - static_assert( testComparisons6( + static_assert( testComparisons( year_month_day{year{1234}, February, day{1}}, year_month_day{year{1235}, January, day{1}}, false, true), ""); // different year and day - static_assert( testComparisons6( + static_assert( testComparisons( year_month_day{year{1234}, January, day{2}}, year_month_day{year{1235}, January, day{1}}, false, true), ""); // different year, month and day - static_assert( testComparisons6( + static_assert( testComparisons( year_month_day{year{1234}, February, day{2}}, year_month_day{year{1235}, January, day{1}}, false, true), ""); @@ -94,7 +94,7 @@ // same year, different days for (unsigned i = 1; i < 28; ++i) for (unsigned j = 1; j < 28; ++j) - assert((testComparisons6( + assert((testComparisons( year_month_day{year{1234}, January, day{i}}, year_month_day{year{1234}, January, day{j}}, i == j, i < j ))); @@ -102,7 +102,7 @@ // same year, different months for (unsigned i = 1; i < 12; ++i) for (unsigned j = 1; j < 12; ++j) - assert((testComparisons6( + assert((testComparisons( year_month_day{year{1234}, month{i}, day{12}}, year_month_day{year{1234}, month{j}, day{12}}, i == j, i < j ))); @@ -110,7 +110,7 @@ // same month, different years for (int i = 1000; i < 2000; ++i) for (int j = 1000; j < 2000; ++j) - assert((testComparisons6( + assert((testComparisons( year_month_day{year{i}, January, day{12}}, year_month_day{year{j}, January, day{12}}, i == j, i < j ))); diff --git a/libcxx/test/std/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/comparisons.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/comparisons.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/comparisons.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/comparisons.pass.cpp @@ -33,37 +33,37 @@ using month_day_last = std::chrono::month_day_last; using year_month_day_last = std::chrono::year_month_day_last; - AssertComparisons6AreNoexcept(); - AssertComparisons6ReturnBool(); + AssertComparisonsAreNoexcept(); + AssertComparisonsReturnBool(); constexpr month January = std::chrono::January; constexpr month February = std::chrono::February; - static_assert( testComparisons6( + static_assert( testComparisons( year_month_day_last{year{1234}, month_day_last{January}}, year_month_day_last{year{1234}, month_day_last{January}}, true, false), ""); // different month - static_assert( testComparisons6( + static_assert( testComparisons( year_month_day_last{year{1234}, month_day_last{January}}, year_month_day_last{year{1234}, month_day_last{February}}, false, true), ""); // different year - static_assert( testComparisons6( + static_assert( testComparisons( year_month_day_last{year{1234}, month_day_last{January}}, year_month_day_last{year{1235}, month_day_last{January}}, false, true), ""); // different month - static_assert( testComparisons6( + static_assert( testComparisons( year_month_day_last{year{1234}, month_day_last{January}}, year_month_day_last{year{1234}, month_day_last{February}}, false, true), ""); // different year and month - static_assert( testComparisons6( + static_assert( testComparisons( year_month_day_last{year{1234}, month_day_last{February}}, year_month_day_last{year{1235}, month_day_last{January}}, false, true), ""); @@ -71,7 +71,7 @@ // same year, different months for (unsigned i = 1; i < 12; ++i) for (unsigned j = 1; j < 12; ++j) - assert((testComparisons6( + assert((testComparisons( year_month_day_last{year{1234}, month_day_last{month{i}}}, year_month_day_last{year{1234}, month_day_last{month{j}}}, i == j, i < j ))); @@ -79,7 +79,7 @@ // same month, different years for (int i = 1000; i < 2000; ++i) for (int j = 1000; j < 2000; ++j) - assert((testComparisons6( + assert((testComparisons( year_month_day_last{year{i}, month_day_last{January}}, year_month_day_last{year{j}, month_day_last{January}}, i == j, i < j ))); diff --git a/libcxx/test/std/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/comparisons.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/comparisons.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/comparisons.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/comparisons.pass.cpp @@ -30,57 +30,57 @@ using weekday = std::chrono::weekday; using year_month_weekday = std::chrono::year_month_weekday; - AssertComparisons2AreNoexcept(); - AssertComparisons2ReturnBool(); + AssertEqualityAreNoexcept(); + AssertEqualityReturnBool(); constexpr month January = std::chrono::January; constexpr month February = std::chrono::February; constexpr weekday Tuesday = std::chrono::Tuesday; - static_assert( testComparisons2( + static_assert( testEquality( year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 1}}, year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 1}}, true), ""); // different day - static_assert( testComparisons2( + static_assert( testEquality( year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 1}}, year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 2}}, false), ""); // different month - static_assert( testComparisons2( + static_assert( testEquality( year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 1}}, year_month_weekday{year{1234}, February, weekday_indexed{Tuesday, 1}}, false), ""); // different year - static_assert( testComparisons2( + static_assert( testEquality( year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 1}}, year_month_weekday{year{1235}, January, weekday_indexed{Tuesday, 1}}, false), ""); // different month and day - static_assert( testComparisons2( + static_assert( testEquality( year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 1}}, year_month_weekday{year{1234}, February, weekday_indexed{Tuesday, 2}}, false), ""); // different year and month - static_assert( testComparisons2( + static_assert( testEquality( year_month_weekday{year{1234}, February, weekday_indexed{Tuesday, 1}}, year_month_weekday{year{1235}, January, weekday_indexed{Tuesday, 1}}, false), ""); // different year and day - static_assert( testComparisons2( + static_assert( testEquality( year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 2}}, year_month_weekday{year{1235}, January, weekday_indexed{Tuesday, 1}}, false), ""); // different year, month and day - static_assert( testComparisons2( + static_assert( testEquality( year_month_weekday{year{1234}, February, weekday_indexed{Tuesday, 2}}, year_month_weekday{year{1235}, January, weekday_indexed{Tuesday, 1}}, false), ""); @@ -89,7 +89,7 @@ // same year, different days for (unsigned i = 1; i < 28; ++i) for (unsigned j = 1; j < 28; ++j) - assert((testComparisons2( + assert((testEquality( year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, i}}, year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, j}}, i == j))); @@ -97,7 +97,7 @@ // same year, different months for (unsigned i = 1; i < 12; ++i) for (unsigned j = 1; j < 12; ++j) - assert((testComparisons2( + assert((testEquality( year_month_weekday{year{1234}, month{i}, weekday_indexed{Tuesday, 1}}, year_month_weekday{year{1234}, month{j}, weekday_indexed{Tuesday, 1}}, i == j))); @@ -105,7 +105,7 @@ // same month, different years for (int i = 1000; i < 2000; ++i) for (int j = 1000; j < 2000; ++j) - assert((testComparisons2( + assert((testEquality( year_month_weekday{year{i}, January, weekday_indexed{Tuesday, 1}}, year_month_weekday{year{j}, January, weekday_indexed{Tuesday, 1}}, i == j))); diff --git a/libcxx/test/std/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/comparisons.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/comparisons.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/comparisons.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/comparisons.pass.cpp @@ -30,58 +30,58 @@ using weekday_last = std::chrono::weekday_last; using year_month_weekday_last = std::chrono::year_month_weekday_last; - AssertComparisons2AreNoexcept(); - AssertComparisons2ReturnBool(); + AssertEqualityAreNoexcept(); + AssertEqualityReturnBool(); constexpr month January = std::chrono::January; constexpr month February = std::chrono::February; constexpr weekday Tuesday = std::chrono::Tuesday; constexpr weekday Wednesday = std::chrono::Wednesday; - static_assert( testComparisons2( + static_assert( testEquality( year_month_weekday_last{year{1234}, January, weekday_last{Tuesday}}, year_month_weekday_last{year{1234}, January, weekday_last{Tuesday}}, true), ""); // different day - static_assert( testComparisons2( + static_assert( testEquality( year_month_weekday_last{year{1234}, January, weekday_last{Tuesday}}, year_month_weekday_last{year{1234}, January, weekday_last{Wednesday}}, false), ""); // different month - static_assert( testComparisons2( + static_assert( testEquality( year_month_weekday_last{year{1234}, January, weekday_last{Tuesday}}, year_month_weekday_last{year{1234}, February, weekday_last{Tuesday}}, false), ""); // different year - static_assert( testComparisons2( + static_assert( testEquality( year_month_weekday_last{year{1234}, January, weekday_last{Tuesday}}, year_month_weekday_last{year{1235}, January, weekday_last{Tuesday}}, false), ""); // different month and day - static_assert( testComparisons2( + static_assert( testEquality( year_month_weekday_last{year{1234}, January, weekday_last{Tuesday}}, year_month_weekday_last{year{1234}, February, weekday_last{Wednesday}}, false), ""); // different year and month - static_assert( testComparisons2( + static_assert( testEquality( year_month_weekday_last{year{1234}, February, weekday_last{Tuesday}}, year_month_weekday_last{year{1235}, January, weekday_last{Tuesday}}, false), ""); // different year and day - static_assert( testComparisons2( + static_assert( testEquality( year_month_weekday_last{year{1234}, January, weekday_last{Wednesday}}, year_month_weekday_last{year{1235}, January, weekday_last{Tuesday}}, false), ""); // different year, month and day - static_assert( testComparisons2( + static_assert( testEquality( year_month_weekday_last{year{1234}, February, weekday_last{Wednesday}}, year_month_weekday_last{year{1235}, January, weekday_last{Tuesday}}, false), ""); @@ -90,7 +90,7 @@ // same year, different days for (unsigned i = 1; i < 28; ++i) for (unsigned j = 1; j < 28; ++j) - assert((testComparisons2( + assert((testEquality( year_month_weekday_last{year{1234}, January, weekday_last{weekday{i}}}, year_month_weekday_last{year{1234}, January, weekday_last{weekday{j}}}, i == j))); @@ -98,7 +98,7 @@ // same year, different months for (unsigned i = 1; i < 12; ++i) for (unsigned j = 1; j < 12; ++j) - assert((testComparisons2( + assert((testEquality( year_month_weekday_last{year{1234}, month{i}, weekday_last{Tuesday}}, year_month_weekday_last{year{1234}, month{j}, weekday_last{Tuesday}}, i == j))); @@ -106,7 +106,7 @@ // same month, different years for (int i = 1000; i < 2000; ++i) for (int j = 1000; j < 2000; ++j) - assert((testComparisons2( + assert((testEquality( year_month_weekday_last{year{i}, January, weekday_last{Tuesday}}, year_month_weekday_last{year{j}, January, weekday_last{Tuesday}}, i == j))); diff --git a/libcxx/test/support/test_comparisons.h b/libcxx/test/support/test_comparisons.h --- a/libcxx/test/support/test_comparisons.h +++ b/libcxx/test/support/test_comparisons.h @@ -7,13 +7,18 @@ //===----------------------------------------------------------------------===// // A set of routines for testing the comparison operators of a type // -// XXXX6 tests all six comparison operators -// XXXX2 tests only op== and op!= +// FooOrder All seven comparison operators, requires C++20 or newer. +// FooComparison All six pre-C++20 comparison operators +// FooEquality Equality operators operator== and operator!= // -// AssertComparisonsXAreNoexcept static_asserts that the operations are all noexcept. -// AssertComparisonsXReturnBool static_asserts that the operations return bool. -// AssertComparisonsXConvertibleToBool static_asserts that the operations return something convertible to bool. - +// AssertXAreNoexcept static_asserts that the operations are all noexcept. +// AssertXReturnBool static_asserts that the operations return bool. +// AssertOrderReturn static_asserts that the pre-C++20 comparison operations +// return bool and operator<=> returns the proper type. +// AssertXConvertibleToBool static_asserts that the operations return something convertible to bool. +// testXValues returns the result of the comparison of all operations. +// +// AssertOrderConvertibleToBool doesn't exist yet. It will be implemented when needed. #ifndef TEST_COMPARISONS_H #define TEST_COMPARISONS_H @@ -24,7 +29,7 @@ // Test all six comparison operations for sanity template -TEST_CONSTEXPR_CXX14 bool testComparisons6(const T& t1, const U& t2, bool isEqual, bool isLess) +TEST_CONSTEXPR_CXX14 bool testComparisons(const T& t1, const U& t2, bool isEqual, bool isLess) { assert(!(isEqual && isLess) && "isEqual and isLess cannot be both true"); if (isEqual) @@ -78,16 +83,16 @@ // Easy call when you can init from something already comparable. template -TEST_CONSTEXPR_CXX14 bool testComparisons6Values(Param val1, Param val2) +TEST_CONSTEXPR_CXX14 bool testComparisonsValues(Param val1, Param val2) { const bool isEqual = val1 == val2; const bool isLess = val1 < val2; - return testComparisons6(T(val1), T(val2), isEqual, isLess); + return testComparisons(T(val1), T(val2), isEqual, isLess); } template -void AssertComparisons6AreNoexcept() +void AssertComparisonsAreNoexcept() { ASSERT_NOEXCEPT(std::declval() == std::declval()); ASSERT_NOEXCEPT(std::declval() != std::declval()); @@ -98,7 +103,7 @@ } template -void AssertComparisons6ReturnBool() +void AssertComparisonsReturnBool() { ASSERT_SAME_TYPE(decltype(std::declval() == std::declval()), bool); ASSERT_SAME_TYPE(decltype(std::declval() != std::declval()), bool); @@ -110,7 +115,7 @@ template -void AssertComparisons6ConvertibleToBool() +void AssertComparisonsConvertibleToBool() { static_assert((std::is_convertible() == std::declval()), bool>::value), ""); static_assert((std::is_convertible() != std::declval()), bool>::value), ""); @@ -120,9 +125,35 @@ static_assert((std::is_convertible() >= std::declval()), bool>::value), ""); } +#if TEST_STD_VER > 17 +template +void AssertOrderAreNoexcept() { + AssertComparisonsAreNoexcept(); + ASSERT_NOEXCEPT(std::declval() <=> std::declval()); +} + +template +void AssertOrderReturn() { + AssertComparisonsReturnBool(); + ASSERT_SAME_TYPE(decltype(std::declval() <=> std::declval()), Order); +} + +template +constexpr bool testOrder(const T& t1, const U& t2, Order order) { + return (t1 <=> t2 == order) && + testComparisons(t1, t2, order == Order::equal || order == Order::equivalent, order == Order::less); +} + +template +constexpr bool testOrderValues(Param val1, Param val2) { + return testOrder(T(val1), T(val2), val1 <=> val2); +} + +#endif + // Test all two comparison operations for sanity template -TEST_CONSTEXPR_CXX14 bool testComparisons2(const T& t1, const U& t2, bool isEqual) +TEST_CONSTEXPR_CXX14 bool testEquality(const T& t1, const U& t2, bool isEqual) { if (isEqual) { @@ -144,22 +175,22 @@ // Easy call when you can init from something already comparable. template -TEST_CONSTEXPR_CXX14 bool testComparisons2Values(Param val1, Param val2) +TEST_CONSTEXPR_CXX14 bool testEqualityValues(Param val1, Param val2) { const bool isEqual = val1 == val2; - return testComparisons2(T(val1), T(val2), isEqual); + return testEquality(T(val1), T(val2), isEqual); } template -void AssertComparisons2AreNoexcept() +void AssertEqualityAreNoexcept() { ASSERT_NOEXCEPT(std::declval() == std::declval()); ASSERT_NOEXCEPT(std::declval() != std::declval()); } template -void AssertComparisons2ReturnBool() +void AssertEqualityReturnBool() { ASSERT_SAME_TYPE(decltype(std::declval() == std::declval()), bool); ASSERT_SAME_TYPE(decltype(std::declval() != std::declval()), bool); @@ -167,7 +198,7 @@ template -void AssertComparisons2ConvertibleToBool() +void AssertEqualityConvertibleToBool() { static_assert((std::is_convertible() == std::declval()), bool>::value), ""); static_assert((std::is_convertible() != std::declval()), bool>::value), "");