diff options
author | Michael de Lang <kingoipo@gmail.com> | 2020-02-26 23:43:45 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-11-16 16:43:20 +0000 |
commit | b96e2ff9d8c56bad68b5dd10e3a601f12496ae36 (patch) | |
tree | bb97dfa04d0f580e96565e79ce5b705aa9c47814 /libstdc++-v3/include/std/version | |
parent | 59434931fb658f0a180ce3f3305cb3987ed2b56d (diff) | |
download | gcc-b96e2ff9d8c56bad68b5dd10e3a601f12496ae36.zip gcc-b96e2ff9d8c56bad68b5dd10e3a601f12496ae36.tar.gz gcc-b96e2ff9d8c56bad68b5dd10e3a601f12496ae36.tar.bz2 |
libstdc++: Implement constexpr std::basic_string for C++20
This is only supported for the cxx11 ABI, not for COW strings.
libstdc++-v3/ChangeLog:
* include/bits/basic_string.h (basic_string, operator""s): Add
constexpr for C++20.
(basic_string::basic_string(basic_string&&)): Only copy
initialized portion of the buffer.
(basic_string::basic_string(basic_string&&, const Alloc&)):
Likewise.
* include/bits/basic_string.tcc (basic_string): Add constexpr
for C++20.
(basic_string::swap(basic_string&)): Only copy initialized
portions of the buffers.
(basic_string::_M_replace): Add constexpr implementation that
doesn't depend on pointer comparisons.
* include/bits/cow_string.h: Adjust comment.
* include/ext/type_traits.h (__is_null_pointer): Add constexpr.
* include/std/string (erase, erase_if): Add constexpr.
* include/std/version (__cpp_lib_constexpr_string): Update
value.
* testsuite/21_strings/basic_string/cons/char/constexpr.cc:
New test.
* testsuite/21_strings/basic_string/cons/wchar_t/constexpr.cc:
New test.
* testsuite/21_strings/basic_string/literals/constexpr.cc:
New test.
* testsuite/21_strings/basic_string/modifiers/constexpr.cc: New test.
* testsuite/21_strings/basic_string/modifiers/swap/char/constexpr.cc:
New test.
* testsuite/21_strings/basic_string/modifiers/swap/wchar_t/constexpr.cc:
New test.
* testsuite/21_strings/basic_string/version.cc: New test.
Diffstat (limited to 'libstdc++-v3/include/std/version')
-rw-r--r-- | libstdc++-v3/include/std/version | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version index 0930de8..fd7e125 100644 --- a/libstdc++-v3/include/std/version +++ b/libstdc++-v3/include/std/version @@ -232,7 +232,11 @@ #define __cpp_lib_constexpr_memory 201811L #define __cpp_lib_constexpr_numeric 201911L #ifdef __cpp_lib_is_constant_evaluated -# define __cpp_lib_constexpr_string 201811L +# if _GLIBCXX_USE_CXX11_ABI +# define __cpp_lib_constexpr_string 201907L +# else +# define __cpp_lib_constexpr_string 201811L +# endif #endif #define __cpp_lib_constexpr_string_view 201811L #define __cpp_lib_constexpr_tuple 201811L |