2020-02-27 Jonathan Wakely <jwakely@redhat.com>
+ * include/debug/array (operator<=>): Define for C++20.
+ * testsuite/23_containers/array/tuple_interface/get_debug_neg.cc:
+ Adjust dg-error line numbers.
+ * testsuite/23_containers/array/tuple_interface/
+ tuple_element_debug_neg.cc: Likewise.
+
* testsuite/23_containers/span/back_assert_neg.cc: Add #undef before
defining _GLIBCXX_ASSERTIONS.
* testsuite/23_containers/span/first_2_assert_neg.cc: Likewise.
operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return std::equal(__one.begin(), __one.end(), __two.begin()); }
+#if __cpp_lib_three_way_comparison && __cpp_lib_concepts
+ template<typename _Tp, size_t _Nm>
+ constexpr __detail::__synth3way_t<_Tp>
+ operator<=>(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
+ {
+ if constexpr (_Nm && __is_byte<_Tp>::__value)
+ return __builtin_memcmp(__a.data(), __b.data(), _Nm) <=> 0;
+ else
+ {
+ for (size_t __i = 0; __i < _Nm; ++__i)
+ {
+ auto __c = __detail::__synth3way(__a[__i], __b[__i]);
+ if (__c != 0)
+ return __c;
+ }
+ }
+ return strong_ordering::equal;
+ }
+#else
template<typename _Tp, std::size_t _Nm>
_GLIBCXX20_CONSTEXPR
inline bool
inline bool
operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one < __two); }
+#endif // three_way_comparison && concepts
// Specialized algorithms.
int n2 = std::get<1>(std::move(a));
int n3 = std::get<1>(ca);
-// { dg-error "static assertion failed" "" { target *-*-* } 295 }
-// { dg-error "static assertion failed" "" { target *-*-* } 304 }
-// { dg-error "static assertion failed" "" { target *-*-* } 312 }
+// { dg-error "static assertion failed" "" { target *-*-* } 315 }
+// { dg-error "static assertion failed" "" { target *-*-* } 324 }
+// { dg-error "static assertion failed" "" { target *-*-* } 332 }