[gcc(refs/vendors/redhat/heads/gcc-8-branch)] libstdc++: Fix inconsistent feature test macro

Jakub Jelinek jakub@gcc.gnu.org
Fri May 14 14:55:51 GMT 2021


https://gcc.gnu.org/g:a05fd4b11a25493a37adab293a979f5dbae84998

commit a05fd4b11a25493a37adab293a979f5dbae84998
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Apr 30 20:32:05 2021 +0100

    libstdc++: Fix inconsistent feature test macro
    
    The __cpp_lib_constexpr_string feature test macro is not defined
    consistently in <version> and <string>.
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/basic_string.h (__cpp_lib_constexpr_string):
            Only define for C++17 and later.
    
    (cherry picked from commit 3215d4f5b3d08e0087a88df9e155c779927ace1a)

Diff:
---
 libstdc++-v3/include/bits/basic_string.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index 0be11c0c444..5eede562884 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -52,7 +52,10 @@ namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#define __cpp_lib_constexpr_string 201611L
+#if __cplusplus >= 201703L
+// Support P0426R1 changes to char_traits in C++17.
+# define __cpp_lib_constexpr_string 201611L
+#endif
 
 #if _GLIBCXX_USE_CXX11_ABI
 _GLIBCXX_BEGIN_NAMESPACE_CXX11


More information about the Libstdc++-cvs mailing list