aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrançois Dumont <fdumont@gcc.gnu.org>2019-09-30 20:33:51 +0000
committerFrançois Dumont <fdumont@gcc.gnu.org>2019-09-30 20:33:51 +0000
commit2d2ad752c044c4a0520d750b33cb88e9612936b3 (patch)
treea908984658d1b582ce7a51e0cbfdc525d027c5f5
parentb54453598a1b25f249d371ddfdc02304b95e9d93 (diff)
downloadgcc-2d2ad752c044c4a0520d750b33cb88e9612936b3.zip
gcc-2d2ad752c044c4a0520d750b33cb88e9612936b3.tar.gz
gcc-2d2ad752c044c4a0520d750b33cb88e9612936b3.tar.bz2
Implement C++20 constexpr comparison operators for __debug::array (P1023).
* include/debug/array: Add C++20 constexpr to comparison operators. * testsuite/23_containers/array/tuple_interface/get_debug_neg.cc: Adapt dg-error line numbers. * testsuite/23_containers/array/tuple_interface/ tuple_element_debug_neg.cc: Likewise. From-SVN: r276375
-rw-r--r--libstdc++-v3/include/debug/array6
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc6
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc2
3 files changed, 10 insertions, 4 deletions
diff --git a/libstdc++-v3/include/debug/array b/libstdc++-v3/include/debug/array
index 2f8eb84..5566a08 100644
--- a/libstdc++-v3/include/debug/array
+++ b/libstdc++-v3/include/debug/array
@@ -234,16 +234,19 @@ namespace __debug
// Array comparisons.
template<typename _Tp, std::size_t _Nm>
+ _GLIBCXX20_CONSTEXPR
inline bool
operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return std::equal(__one.begin(), __one.end(), __two.begin()); }
template<typename _Tp, std::size_t _Nm>
+ _GLIBCXX20_CONSTEXPR
inline bool
operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one == __two); }
template<typename _Tp, std::size_t _Nm>
+ _GLIBCXX20_CONSTEXPR
inline bool
operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
{
@@ -252,16 +255,19 @@ namespace __debug
}
template<typename _Tp, std::size_t _Nm>
+ _GLIBCXX20_CONSTEXPR
inline bool
operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return __two < __one; }
template<typename _Tp, std::size_t _Nm>
+ _GLIBCXX20_CONSTEXPR
inline bool
operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one > __two); }
template<typename _Tp, std::size_t _Nm>
+ _GLIBCXX20_CONSTEXPR
inline bool
operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one < __two); }
diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc
index f9880b4..3c60a43 100644
--- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc
@@ -27,6 +27,6 @@ int n1 = std::get<1>(a);
int n2 = std::get<1>(std::move(a));
int n3 = std::get<1>(ca);
-// { dg-error "static assertion failed" "" { target *-*-* } 288 }
-// { dg-error "static assertion failed" "" { target *-*-* } 297 }
-// { dg-error "static assertion failed" "" { target *-*-* } 305 }
+// { dg-error "static assertion failed" "" { target *-*-* } 294 }
+// { dg-error "static assertion failed" "" { target *-*-* } 303 }
+// { dg-error "static assertion failed" "" { target *-*-* } 311 }
diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc
index 10b1681..a6b44eb 100644
--- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc
@@ -22,4 +22,4 @@
typedef std::tuple_element<1, std::array<int, 1>>::type type;
-// { dg-error "static assertion failed" "" { target *-*-* } 331 }
+// { dg-error "static assertion failed" "" { target *-*-* } 376 }