public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tamar Christina <tnfchris@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/ARM/heads/arm-struct-reorg-wip)] libstdc++: Change __cpp_lib_array_constexpr for C++17 again
Date: Fri, 17 Jul 2020 14:42:30 +0000 (GMT)	[thread overview]
Message-ID: <20200717144230.84B4D3B96004@sourceware.org> (raw)

https://gcc.gnu.org/g:40541efe1c063e9ce894b5f11ff727e4aec56e8b

commit 40541efe1c063e9ce894b5f11ff727e4aec56e8b
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Apr 23 21:39:33 2020 +0100

    libstdc++: Change __cpp_lib_array_constexpr for C++17 again
    
    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.

Diff:
---
 libstdc++-v3/ChangeLog                                            | 8 ++++++++
 libstdc++-v3/include/bits/stl_iterator.h                          | 2 +-
 libstdc++-v3/include/std/version                                  | 2 +-
 .../23_containers/array/element_access/constexpr_c++17.cc         | 2 --
 .../testsuite/23_containers/array/requirements/constexpr_iter.cc  | 7 ++++---
 5 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 52535464984..7ce32b9348b 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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.
 
diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h
index d7e85b84041..cc0b3e0a766 100644
--- a/libstdc++-v3/include/bits/stl_iterator.h
+++ b/libstdc++-v3/include/bits/stl_iterator.h
@@ -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
diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
index 1beb9aa938e..fa505f25e98 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -123,7 +123,7 @@
 #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
diff --git a/libstdc++-v3/testsuite/23_containers/array/element_access/constexpr_c++17.cc b/libstdc++-v3/testsuite/23_containers/array/element_access/constexpr_c++17.cc
index 56d1cf256be..dd69645833f 100644
--- a/libstdc++-v3/testsuite/23_containers/array/element_access/constexpr_c++17.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/element_access/constexpr_c++17.cc
@@ -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()
diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_iter.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_iter.cc
index a119937f773..566388405b6 100644
--- a/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_iter.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_iter.cc
@@ -22,12 +22,13 @@
 
 #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()
 {


                 reply	other threads:[~2020-07-17 14:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200717144230.84B4D3B96004@sourceware.org \
    --to=tnfchris@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).