]> gcc.gnu.org Git - gcc.git/commitdiff
libstdc++: Change __cpp_lib_array_constexpr for C++17 again
authorJonathan Wakely <jwakely@redhat.com>
Thu, 23 Apr 2020 20:39:33 +0000 (21:39 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 23 Apr 2020 20:39:33 +0000 (21:39 +0100)
This partially reverts my previous change related to this macro. The
C++20 constexpr iterator requirements are always met by array:iterator,
because it's just a pointer. So the macro can be set to 201803 even in
C++17 mode.

* include/bits/stl_iterator.h (__cpp_lib_array_constexpr): Revert
value for C++17 to 201803L because P0858R0 is supported for C++17.
* include/std/version (__cpp_lib_array_constexpr): Likewise.
* testsuite/23_containers/array/element_access/constexpr_c++17.cc:
Check for value corresponding to P0031R0 features being tested.
* testsuite/23_containers/array/requirements/constexpr_iter.cc:
Check for value corresponding to P0858R0 features being tested.

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_iterator.h
libstdc++-v3/include/std/version
libstdc++-v3/testsuite/23_containers/array/element_access/constexpr_c++17.cc
libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_iter.cc

index 52535464984d040e1910cbf7c0df4ee06c62f86d..7ce32b9348bce94ecd81ed018d3cbb1ceedd5a86 100644 (file)
@@ -1,5 +1,13 @@
 2020-04-23  Jonathan Wakely  <jwakely@redhat.com>
 
+       * include/bits/stl_iterator.h (__cpp_lib_array_constexpr): Revert
+       value for C++17 to 201803L because P0858R0 is supported for C++17.
+       * include/std/version (__cpp_lib_array_constexpr): Likewise.
+       * testsuite/23_containers/array/element_access/constexpr_c++17.cc:
+       Check for value corresponding to P0031R0 features being tested.
+       * testsuite/23_containers/array/requirements/constexpr_iter.cc:
+       Check for value corresponding to P0858R0 features being tested.
+
        * include/std/version (__cpp_lib_three_way_comparison): Define for
        freestanding builds.
 
index d7e85b84041d00e1642b98f00a326c09e366bad0..cc0b3e0a7668996e2dc8ab60b01211b979358ca9 100644 (file)
@@ -72,7 +72,7 @@
 #if __cplusplus > 201703L
 # define __cpp_lib_array_constexpr 201811L
 #elif __cplusplus == 201703L
-# define __cpp_lib_array_constexpr 201603L
+# define __cpp_lib_array_constexpr 201803L
 #endif
 
 #if __cplusplus > 201703L
index 1beb9aa938ef0ae6033328e9f9ddc7d6a07edf3a..fa505f25e981d5daaf51a212e9c6cc81ea454e5e 100644 (file)
 #if _GLIBCXX_HOSTED
 #define __cpp_lib_any 201606L
 #define __cpp_lib_apply 201603
-#define __cpp_lib_array_constexpr 201603L
+#define __cpp_lib_array_constexpr 201803L
 #define __cpp_lib_as_const 201510
 #define __cpp_lib_boyer_moore_searcher 201603
 #define __cpp_lib_chrono 201611
index 56d1cf256be951aa6278c8ddd6385da95585888a..dd69645833f6eaf7e79c9c74f4aa87d5fadbde5f 100644 (file)
@@ -24,8 +24,6 @@
 # error "Feature test macro for array constexpr is missing in <array>"
 #elif __cpp_lib_array_constexpr < 201603L
 # error "Feature test macro for array constexpr has wrong value in <array>"
-#elif __cpp_lib_array_constexpr > 201603L && __cplusplus == 201703
-# error "Feature test macro for array constexpr has wrong value for C++17"
 #endif
 
 constexpr std::size_t test01()
index a119937f7738b2ccfb1fcf27da4b67d5d04952d0..566388405b6cf1ed1604b4a15dad57a764a06393 100644 (file)
 
 #ifndef __cpp_lib_array_constexpr
 # error "Feature test macro for array constexpr is missing in <array>"
-#elif __cpp_lib_array_constexpr < 201603L
+#elif __cpp_lib_array_constexpr < 201803L
 # error "Feature test macro for array constexpr has wrong value in <array>"
-#elif __cpp_lib_array_constexpr > 201603L && __cplusplus == 201703
-# error "Feature test macro for array constexpr has wrong value for C++17"
 #endif
 
+// This test is compiled as C++17 because array::iterator is just a pointer,
+// so always meets the C++20 constexpr iterator requirements, even in C++17.
+
 constexpr int
 test()
 {
This page took 0.08061 seconds and 5 git commands to generate.