public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/redhat/heads/gcc-8-branch)] libstdc++: Define __cpp_lib_constexpr_string macro
@ 2021-05-14 14:55 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2021-05-14 14:55 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:0ad96c247e45039a7f86a08a5238b77236dd8cb6

commit 0ad96c247e45039a7f86a08a5238b77236dd8cb6
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Apr 28 15:56:04 2021 +0100

    libstdc++: Define __cpp_lib_constexpr_string macro
    
    As noted in r11-1339-gb6ab9ecd550227684643b41e9e33a4d3466724d8 we define
    a non-standard __cpp_lib_constexpr_char_traits feature test macro to
    indicate support for P0426R1 and P1032R1. At some point last year the
    __cpp_lib_constexpr_string macro was retconned to indicate support for
    those papers. This adds the new macro (which we didn't previously
    define, because it referred to P0980R1 "Making std::string constexpr"
    which we don't support).
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/basic_string.h (__cpp_lib_constexpr_string): Define.
            * testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc:
            Check for __cpp_lib_constexpr_string.
    
    (cherry picked from commit 3da80ed7efd582575e7850a403ce693ec882d087)

Diff:
---
 libstdc++-v3/include/bits/basic_string.h                           | 3 ++-
 .../char_traits/requirements/constexpr_functions_c++17.cc          | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index 0f5d398fcf2..0be11c0c444 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -48,11 +48,12 @@
 # include <string_view>
 #endif
 
-
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
+#define __cpp_lib_constexpr_string 201611L
+
 #if _GLIBCXX_USE_CXX11_ABI
 _GLIBCXX_BEGIN_NAMESPACE_CXX11
   /**
diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc
index 87ea4d89a62..6a5ea249752 100644
--- a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc
+++ b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc
@@ -73,6 +73,13 @@ template<typename CT>
     return true;
   }
 
+#ifndef __cpp_lib_constexpr_string
+# error Feature-test macro for constexpr char_traits is missing
+#elif __cpp_lib_constexpr_string < 201611
+# error Feature-test macro for constexpr char_traits has the wrong value
+#endif
+
+// We also provide this non-standard macro for P0426R1.
 #ifndef __cpp_lib_constexpr_char_traits
 # error Feature-test macro for constexpr char_traits is missing
 #elif __cpp_lib_constexpr_char_traits != 201611


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-14 14:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-14 14:55 [gcc(refs/vendors/redhat/heads/gcc-8-branch)] libstdc++: Define __cpp_lib_constexpr_string macro Jakub Jelinek

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