From 5a95794c58161276de626abb1479f498f3ae76b9 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 15 Jun 2018 16:47:56 +0100 Subject: [PATCH] Only define __cpp_lib_constexpr_char_traits for C++17 * include/bits/char_traits.h (__cpp_lib_constexpr_char_traits): Only define for C++17 and above. From-SVN: r261634 --- libstdc++-v3/ChangeLog | 3 +++ libstdc++-v3/include/bits/char_traits.h | 18 +++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 31c8f369520..cf6bfc9509a 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,8 @@ 2018-06-15 Jonathan Wakely + * include/bits/char_traits.h (__cpp_lib_constexpr_char_traits): Only + define for C++17 and above. + LWG 2993 reference_wrapper conversion from T&& * doc/xml/manual/intro.xml: Document LWG 2993 change. * include/bits/refwrap.h (reference_wrapper(_Tp&)): Remove. diff --git a/libstdc++-v3/include/bits/char_traits.h b/libstdc++-v3/include/bits/char_traits.h index 51cd321b8ae..7cc7c74e8fe 100644 --- a/libstdc++-v3/include/bits/char_traits.h +++ b/libstdc++-v3/include/bits/char_traits.h @@ -143,8 +143,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return !eq_int_type(__c, eof()) ? __c : to_int_type(char_type()); } }; -#define __cpp_lib_constexpr_char_traits 201611 - template _GLIBCXX14_CONSTEXPR int char_traits<_CharT>:: @@ -216,7 +214,9 @@ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION -#if __cplusplus > 201402 +#if __cplusplus >= 201703L +#define __cpp_lib_constexpr_char_traits 201611 + /** * @brief Determine whether the characters of a NULL-terminated * string are known at compile time. @@ -299,7 +299,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static _GLIBCXX17_CONSTEXPR int compare(const char_type* __s1, const char_type* __s2, size_t __n) { -#if __cplusplus > 201402 +#if __cplusplus >= 201703L if (__builtin_constant_p(__n) && __constant_char_array_p(__s1, __n) && __constant_char_array_p(__s2, __n)) @@ -313,7 +313,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static _GLIBCXX17_CONSTEXPR size_t length(const char_type* __s) { -#if __cplusplus > 201402 +#if __cplusplus >= 201703L if (__constant_string_p(__s)) return __gnu_cxx::char_traits::length(__s); #endif @@ -323,7 +323,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static _GLIBCXX17_CONSTEXPR const char_type* find(const char_type* __s, size_t __n, const char_type& __a) { -#if __cplusplus > 201402 +#if __cplusplus >= 201703L if (__builtin_constant_p(__n) && __builtin_constant_p(__a) && __constant_char_array_p(__s, __n)) @@ -408,7 +408,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static _GLIBCXX17_CONSTEXPR int compare(const char_type* __s1, const char_type* __s2, size_t __n) { -#if __cplusplus > 201402 +#if __cplusplus >= 201703L if (__builtin_constant_p(__n) && __constant_char_array_p(__s1, __n) && __constant_char_array_p(__s2, __n)) @@ -423,7 +423,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static _GLIBCXX17_CONSTEXPR size_t length(const char_type* __s) { -#if __cplusplus > 201402 +#if __cplusplus >= 201703L if (__constant_string_p(__s)) return __gnu_cxx::char_traits::length(__s); else @@ -434,7 +434,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static _GLIBCXX17_CONSTEXPR const char_type* find(const char_type* __s, size_t __n, const char_type& __a) { -#if __cplusplus > 201402 +#if __cplusplus >= 201703L if (__builtin_constant_p(__n) && __builtin_constant_p(__a) && __constant_char_array_p(__s, __n)) -- 2.30.2