Re: [PATCH] Implement C++20 P1023 for __debug::array

2019-10-01 Thread Jonathan Wakely

On 30/09/19 22:31 +0200, François Dumont wrote:

This is a missing part of C++20 P1023 for __debug::array.

    Implement C++20 p1023 - constexpr comparison operators for 
__debug::array.

    * 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.


Tested under Linux x86_64 normal and debug modes.


Thanks.



[PATCH] Implement C++20 P1023 for __debug::array

2019-09-30 Thread François Dumont

This is a missing part of C++20 P1023 for __debug::array.

    Implement C++20 p1023 - constexpr comparison operators for 
__debug::array.

    * 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.


Tested under Linux x86_64 normal and debug modes.

François

diff --git a/libstdc++-v3/include/debug/array b/libstdc++-v3/include/debug/array
index 2f8eb842eb8..5566a087f9a 100644
--- a/libstdc++-v3/include/debug/array
+++ b/libstdc++-v3/include/debug/array
@@ -234,16 +234,19 @@ namespace __debug
 
   // Array comparisons.
   template
+_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
+_GLIBCXX20_CONSTEXPR
 inline bool
 operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
 { return !(__one == __two); }
 
   template
+_GLIBCXX20_CONSTEXPR
 inline bool
 operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
 {
@@ -252,16 +255,19 @@ namespace __debug
 }
 
   template
+_GLIBCXX20_CONSTEXPR
 inline bool
 operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
 { return __two < __one; }
 
   template
+_GLIBCXX20_CONSTEXPR
 inline bool
 operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
 { return !(__one > __two); }
 
   template
+_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 f9880b4b0f5..3c60a435491 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 10b1681c0c4..a6b44eb57fe 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>::type type;
 
-// { dg-error "static assertion failed" "" { target *-*-* } 331 }
+// { dg-error "static assertion failed" "" { target *-*-* } 376 }