[libcxx-commits] [libcxx] 425620c - [libc++] Implement P0980R1 (constexpr std::string)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Apr 27 03:25:42 PDT 2022
Author: Nikolas Klauser
Date: 2022-04-27T12:25:34+02:00
New Revision: 425620ccdd47e56b59512913cdc71e116f951e4e
URL: https://github.com/llvm/llvm-project/commit/425620ccdd47e56b59512913cdc71e116f951e4e
DIFF: https://github.com/llvm/llvm-project/commit/425620ccdd47e56b59512913cdc71e116f951e4e.diff
LOG: [libc++] Implement P0980R1 (constexpr std::string)
Reviewed By: #libc, ldionne
Spies: daltenty, sdasgup3, ldionne, arichardson, MTC, ChuanqiXu, mehdi_amini, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, Kayjukh, jurahul, msifontes, tatianashp, rdzhabarov, teijeong, cota, dcaballe, Chia-hungDuan, wrengr, wenzhicui, arphaman, Mordante, miscco, Quuxplusone, smeenai, libcxx-commits
Differential Revision: https://reviews.llvm.org/D110598
Added:
Modified:
libcxx/docs/FeatureTestMacroTable.rst
libcxx/docs/Status/Cxx20Papers.csv
libcxx/include/string
libcxx/include/version
libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/string.version.compile.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
libcxx/test/std/strings/basic.string/string.access/at.pass.cpp
libcxx/test/std/strings/basic.string/string.access/back.pass.cpp
libcxx/test/std/strings/basic.string/string.access/front.pass.cpp
libcxx/test/std/strings/basic.string/string.access/index.pass.cpp
libcxx/test/std/strings/basic.string/string.capacity/capacity.pass.cpp
libcxx/test/std/strings/basic.string/string.capacity/clear.pass.cpp
libcxx/test/std/strings/basic.string/string.capacity/empty.pass.cpp
libcxx/test/std/strings/basic.string/string.capacity/empty.verify.cpp
libcxx/test/std/strings/basic.string/string.capacity/length.pass.cpp
libcxx/test/std/strings/basic.string/string.capacity/max_size.pass.cpp
libcxx/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp
libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp
libcxx/test/std/strings/basic.string/string.capacity/resize_and_overwrite.pass.cpp
libcxx/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp
libcxx/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp
libcxx/test/std/strings/basic.string/string.capacity/size.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/alloc.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/char_assignment.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/copy.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/default.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/dtor.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/implicit_deduction_guides.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/initializer_list.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/move.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/move_alloc.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/move_assignment.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/move_noexcept.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/string_view_assignment.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/string_view_deduction.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/string_view_size_size_deduction.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/substr.pass.cpp
libcxx/test/std/strings/basic.string/string.contains/contains.char.pass.cpp
libcxx/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp
libcxx/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.ends_with/ends_with.char.pass.cpp
libcxx/test/std/strings/basic.string/string.ends_with/ends_with.ptr.pass.cpp
libcxx/test/std/strings/basic.string/string.ends_with/ends_with.string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.iterators/begin.pass.cpp
libcxx/test/std/strings/basic.string/string.iterators/cbegin.pass.cpp
libcxx/test/std/strings/basic.string/string.iterators/cend.pass.cpp
libcxx/test/std/strings/basic.string/string.iterators/crbegin.pass.cpp
libcxx/test/std/strings/basic.string/string.iterators/crend.pass.cpp
libcxx/test/std/strings/basic.string/string.iterators/end.pass.cpp
libcxx/test/std/strings/basic.string/string.iterators/iterators.pass.cpp
libcxx/test/std/strings/basic.string/string.iterators/rbegin.pass.cpp
libcxx/test/std/strings/basic.string/string.iterators/rend.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/robust_against_adl.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_assign/initializer_list.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_assign/rv_string.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_view_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/allocator_propagation.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/pointer_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_view_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_view_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/pointer_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_view_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_view_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_view_string.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string.accessors/data.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_compare/pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_compare/string.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_compare/string_view.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_view_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/string_view_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_view_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/string_view_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find/char_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find/string_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_find/string_view_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_rfind/string_view_size.pass.cpp
libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
libcxx/test/std/strings/basic.string/string.require/contiguous.pass.cpp
libcxx/test/std/strings/basic.string/string.starts_with/starts_with.char.pass.cpp
libcxx/test/std/strings/basic.string/string.starts_with/starts_with.ptr.pass.cpp
libcxx/test/std/strings/basic.string/string.starts_with/starts_with.string_view.pass.cpp
libcxx/test/support/constexpr_char_traits.h
libcxx/utils/generate_feature_test_macro_components.py
Removed:
################################################################################
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index 792bbd0a0ed7b..4f2ce96427a1c 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -214,7 +214,7 @@ Status
------------------------------------------------- -----------------
``__cpp_lib_constexpr_numeric`` ``201911L``
------------------------------------------------- -----------------
- ``__cpp_lib_constexpr_string`` ``201811L``
+ ``__cpp_lib_constexpr_string`` ``201907L``
------------------------------------------------- -----------------
``__cpp_lib_constexpr_string_view`` ``201811L``
------------------------------------------------- -----------------
diff --git a/libcxx/docs/Status/Cxx20Papers.csv b/libcxx/docs/Status/Cxx20Papers.csv
index fa88a5a131139..65e4014da15a4 100644
--- a/libcxx/docs/Status/Cxx20Papers.csv
+++ b/libcxx/docs/Status/Cxx20Papers.csv
@@ -106,7 +106,7 @@
"`P0645R10 <https://wg21.link/P0645R10>`__","LWG","Text Formatting","Cologne","|Complete| [#note-P0645]_","14.0"
"`P0660R10 <https://wg21.link/P0660R10>`__","LWG","Stop Token and Joining Thread, Rev 10","Cologne","",""
"`P0784R7 <https://wg21.link/P0784R7>`__","CWG","More constexpr containers","Cologne","|Complete|","12.0"
-"`P0980R1 <https://wg21.link/P0980R1>`__","LWG","Making std::string constexpr","Cologne","",""
+"`P0980R1 <https://wg21.link/P0980R1>`__","LWG","Making std::string constexpr","Cologne","|Complete|","15.0"
"`P1004R2 <https://wg21.link/P1004R2>`__","LWG","Making std::vector constexpr","Cologne","",""
"`P1035R7 <https://wg21.link/P1035R7>`__","LWG","Input Range Adaptors","Cologne","",""
"`P1065R2 <https://wg21.link/P1065R2>`__","LWG","Constexpr INVOKE","Cologne","|Complete|","12.0"
diff --git a/libcxx/include/string b/libcxx/include/string
index bd1c4303e8a40..6666d50958467 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -95,248 +95,246 @@ public:
static const size_type npos = -1;
basic_string()
- noexcept(is_nothrow_default_constructible<allocator_type>::value);
- explicit basic_string(const allocator_type& a);
- basic_string(const basic_string& str);
+ noexcept(is_nothrow_default_constructible<allocator_type>::value); // constexpr since C++20
+ explicit basic_string(const allocator_type& a); // constexpr since C++20
+ basic_string(const basic_string& str); // constexpr since C++20
basic_string(basic_string&& str)
- noexcept(is_nothrow_move_constructible<allocator_type>::value);
+ noexcept(is_nothrow_move_constructible<allocator_type>::value); // constexpr since C++20
basic_string(const basic_string& str, size_type pos,
- const allocator_type& a = allocator_type());
+ const allocator_type& a = allocator_type()); // constexpr since C++20
basic_string(const basic_string& str, size_type pos, size_type n,
- const Allocator& a = Allocator());
+ const Allocator& a = Allocator()); // constexpr since C++20
template<class T>
- basic_string(const T& t, size_type pos, size_type n, const Allocator& a = Allocator()); // C++17
+ basic_string(const T& t, size_type pos, size_type n, const Allocator& a = Allocator()); // C++17, constexpr since C++20
template <class T>
- explicit basic_string(const T& t, const Allocator& a = Allocator()); // C++17
- basic_string(const value_type* s, const allocator_type& a = allocator_type());
- basic_string(const value_type* s, size_type n, const allocator_type& a = allocator_type());
+ explicit basic_string(const T& t, const Allocator& a = Allocator()); // C++17, constexpr since C++20
+ basic_string(const value_type* s, const allocator_type& a = allocator_type()); // constexpr since C++20
+ basic_string(const value_type* s, size_type n, const allocator_type& a = allocator_type()); // constexpr since C++20
basic_string(nullptr_t) = delete; // C++2b
- basic_string(size_type n, value_type c, const allocator_type& a = allocator_type());
+ basic_string(size_type n, value_type c, const allocator_type& a = allocator_type()); // constexpr since C++20
template<class InputIterator>
basic_string(InputIterator begin, InputIterator end,
- const allocator_type& a = allocator_type());
- basic_string(initializer_list<value_type>, const Allocator& = Allocator());
- basic_string(const basic_string&, const Allocator&);
- basic_string(basic_string&&, const Allocator&);
+ const allocator_type& a = allocator_type()); // constexpr since C++20
+ basic_string(initializer_list<value_type>, const Allocator& = Allocator()); // constexpr since C++20
+ basic_string(const basic_string&, const Allocator&); // constexpr since C++20
+ basic_string(basic_string&&, const Allocator&); // constexpr since C++20
- ~basic_string();
+ ~basic_string(); // constexpr since C++20
- operator basic_string_view<charT, traits>() const noexcept;
+ operator basic_string_view<charT, traits>() const noexcept; // constexpr since C++20
- basic_string& operator=(const basic_string& str);
+ basic_string& operator=(const basic_string& str); // constexpr since C++20
template <class T>
- basic_string& operator=(const T& t); // C++17
+ basic_string& operator=(const T& t); // C++17, constexpr since C++20
basic_string& operator=(basic_string&& str)
noexcept(
allocator_type::propagate_on_container_move_assignment::value ||
- allocator_type::is_always_equal::value ); // C++17
- basic_string& operator=(const value_type* s);
+ allocator_type::is_always_equal::value ); // C++17, constexpr since C++20
+ basic_string& operator=(const value_type* s); // constexpr since C++20
basic_string& operator=(nullptr_t) = delete; // C++2b
- basic_string& operator=(value_type c);
- basic_string& operator=(initializer_list<value_type>);
+ basic_string& operator=(value_type c); // constexpr since C++20
+ basic_string& operator=(initializer_list<value_type>); // constexpr since C++20
- iterator begin() noexcept;
- const_iterator begin() const noexcept;
- iterator end() noexcept;
- const_iterator end() const noexcept;
+ iterator begin() noexcept; // constexpr since C++20
+ const_iterator begin() const noexcept; // constexpr since C++20
+ iterator end() noexcept; // constexpr since C++20
+ const_iterator end() const noexcept; // constexpr since C++20
- reverse_iterator rbegin() noexcept;
- const_reverse_iterator rbegin() const noexcept;
- reverse_iterator rend() noexcept;
- const_reverse_iterator rend() const noexcept;
+ reverse_iterator rbegin() noexcept; // constexpr since C++20
+ const_reverse_iterator rbegin() const noexcept; // constexpr since C++20
+ reverse_iterator rend() noexcept; // constexpr since C++20
+ const_reverse_iterator rend() const noexcept; // constexpr since C++20
- const_iterator cbegin() const noexcept;
- const_iterator cend() const noexcept;
- const_reverse_iterator crbegin() const noexcept;
- const_reverse_iterator crend() const noexcept;
+ const_iterator cbegin() const noexcept; // constexpr since C++20
+ const_iterator cend() const noexcept; // constexpr since C++20
+ const_reverse_iterator crbegin() const noexcept; // constexpr since C++20
+ const_reverse_iterator crend() const noexcept; // constexpr since C++20
- size_type size() const noexcept;
- size_type length() const noexcept;
- size_type max_size() const noexcept;
- size_type capacity() const noexcept;
+ size_type size() const noexcept; // constexpr since C++20
+ size_type length() const noexcept; // constexpr since C++20
+ size_type max_size() const noexcept; // constexpr since C++20
+ size_type capacity() const noexcept; // constexpr since C++20
- void resize(size_type n, value_type c);
- void resize(size_type n);
+ void resize(size_type n, value_type c); // constexpr since C++20
+ void resize(size_type n); // constexpr since C++20
template<class Operation>
constexpr void resize_and_overwrite(size_type n, Operation op); // since C++23
- void reserve(size_type res_arg);
+ void reserve(size_type res_arg); // constexpr since C++20
void reserve(); // deprecated in C++20
- void shrink_to_fit();
- void clear() noexcept;
- bool empty() const noexcept;
+ void shrink_to_fit(); // constexpr since C++20
+ void clear() noexcept; // constexpr since C++20
+ bool empty() const noexcept; // constexpr since C++20
- const_reference operator[](size_type pos) const;
- reference operator[](size_type pos);
+ const_reference operator[](size_type pos) const; // constexpr since C++20
+ reference operator[](size_type pos); // constexpr since C++20
- const_reference at(size_type n) const;
- reference at(size_type n);
+ const_reference at(size_type n) const; // constexpr since C++20
+ reference at(size_type n); // constexpr since C++20
- basic_string& operator+=(const basic_string& str);
+ basic_string& operator+=(const basic_string& str); // constexpr since C++20
template <class T>
- basic_string& operator+=(const T& t); // C++17
- basic_string& operator+=(const value_type* s);
- basic_string& operator+=(value_type c);
- basic_string& operator+=(initializer_list<value_type>);
+ basic_string& operator+=(const T& t); // C++17, constexpr since C++20
+ basic_string& operator+=(const value_type* s); // constexpr since C++20
+ basic_string& operator+=(value_type c); // constexpr since C++20
+ basic_string& operator+=(initializer_list<value_type>); // constexpr since C++20
- basic_string& append(const basic_string& str);
+ basic_string& append(const basic_string& str); // constexpr since C++20
template <class T>
- basic_string& append(const T& t); // C++17
- basic_string& append(const basic_string& str, size_type pos, size_type n=npos); //C++14
+ basic_string& append(const T& t); // C++17, constexpr since C++20
+ basic_string& append(const basic_string& str, size_type pos, size_type n=npos); // C++14, constexpr since C++20
template <class T>
- basic_string& append(const T& t, size_type pos, size_type n=npos); // C++17
- basic_string& append(const value_type* s, size_type n);
- basic_string& append(const value_type* s);
- basic_string& append(size_type n, value_type c);
+ basic_string& append(const T& t, size_type pos, size_type n=npos); // C++17, constexpr since C++20
+ basic_string& append(const value_type* s, size_type n); // constexpr since C++20
+ basic_string& append(const value_type* s); // constexpr since C++20
+ basic_string& append(size_type n, value_type c); // constexpr since C++20
template<class InputIterator>
- basic_string& append(InputIterator first, InputIterator last);
- basic_string& append(initializer_list<value_type>);
+ basic_string& append(InputIterator first, InputIterator last); // constexpr since C++20
+ basic_string& append(initializer_list<value_type>); // constexpr since C++20
- void push_back(value_type c);
- void pop_back();
- reference front();
- const_reference front() const;
- reference back();
- const_reference back() const;
+ void push_back(value_type c); // constexpr since C++20
+ void pop_back(); // constexpr since C++20
+ reference front(); // constexpr since C++20
+ const_reference front() const; // constexpr since C++20
+ reference back(); // constexpr since C++20
+ const_reference back() const; // constexpr since C++20
- basic_string& assign(const basic_string& str);
+ basic_string& assign(const basic_string& str); // constexpr since C++20
template <class T>
- basic_string& assign(const T& t); // C++17
- basic_string& assign(basic_string&& str);
- basic_string& assign(const basic_string& str, size_type pos, size_type n=npos); // C++14
+ basic_string& assign(const T& t); // C++17, constexpr since C++20
+ basic_string& assign(basic_string&& str); // constexpr since C++20
+ basic_string& assign(const basic_string& str, size_type pos, size_type n=npos); // C++14, constexpr since C++20
template <class T>
- basic_string& assign(const T& t, size_type pos, size_type n=npos); // C++17
- basic_string& assign(const value_type* s, size_type n);
- basic_string& assign(const value_type* s);
- basic_string& assign(size_type n, value_type c);
+ basic_string& assign(const T& t, size_type pos, size_type n=npos); // C++17, constexpr since C++20
+ basic_string& assign(const value_type* s, size_type n); // constexpr since C++20
+ basic_string& assign(const value_type* s); // constexpr since C++20
+ basic_string& assign(size_type n, value_type c); // constexpr since C++20
template<class InputIterator>
- basic_string& assign(InputIterator first, InputIterator last);
- basic_string& assign(initializer_list<value_type>);
+ basic_string& assign(InputIterator first, InputIterator last); // constexpr since C++20
+ basic_string& assign(initializer_list<value_type>); // constexpr since C++20
- basic_string& insert(size_type pos1, const basic_string& str);
+ basic_string& insert(size_type pos1, const basic_string& str); // constexpr since C++20
template <class T>
- basic_string& insert(size_type pos1, const T& t);
+ basic_string& insert(size_type pos1, const T& t); // constexpr since C++20
basic_string& insert(size_type pos1, const basic_string& str,
- size_type pos2, size_type n);
+ size_type pos2, size_type n); // constexpr since C++20
template <class T>
- basic_string& insert(size_type pos1, const T& t, size_type pos2, size_type n); // C++17
- basic_string& insert(size_type pos, const value_type* s, size_type n=npos); //C++14
- basic_string& insert(size_type pos, const value_type* s);
- basic_string& insert(size_type pos, size_type n, value_type c);
- iterator insert(const_iterator p, value_type c);
- iterator insert(const_iterator p, size_type n, value_type c);
+ basic_string& insert(size_type pos1, const T& t, size_type pos2, size_type n); // C++17, constexpr since C++20
+ basic_string& insert(size_type pos, const value_type* s, size_type n=npos); // C++14, constexpr since C++20
+ basic_string& insert(size_type pos, const value_type* s); // constexpr since C++20
+ basic_string& insert(size_type pos, size_type n, value_type c); // constexpr since C++20
+ iterator insert(const_iterator p, value_type c); // constexpr since C++20
+ iterator insert(const_iterator p, size_type n, value_type c); // constexpr since C++20
template<class InputIterator>
- iterator insert(const_iterator p, InputIterator first, InputIterator last);
- iterator insert(const_iterator p, initializer_list<value_type>);
+ iterator insert(const_iterator p, InputIterator first, InputIterator last); // constexpr since C++20
+ iterator insert(const_iterator p, initializer_list<value_type>); // constexpr since C++20
- basic_string& erase(size_type pos = 0, size_type n = npos);
- iterator erase(const_iterator position);
- iterator erase(const_iterator first, const_iterator last);
+ basic_string& erase(size_type pos = 0, size_type n = npos); // constexpr since C++20
+ iterator erase(const_iterator position); // constexpr since C++20
+ iterator erase(const_iterator first, const_iterator last); // constexpr since C++20
- basic_string& replace(size_type pos1, size_type n1, const basic_string& str);
+ basic_string& replace(size_type pos1, size_type n1, const basic_string& str); // constexpr since C++20
template <class T>
- basic_string& replace(size_type pos1, size_type n1, const T& t); // C++17
+ basic_string& replace(size_type pos1, size_type n1, const T& t); // C++17, constexpr since C++20
basic_string& replace(size_type pos1, size_type n1, const basic_string& str,
- size_type pos2, size_type n2=npos); // C++14
+ size_type pos2, size_type n2=npos); // C++14, constexpr since C++20
template <class T>
basic_string& replace(size_type pos1, size_type n1, const T& t,
- size_type pos2, size_type n); // C++17
- basic_string& replace(size_type pos, size_type n1, const value_type* s, size_type n2);
- basic_string& replace(size_type pos, size_type n1, const value_type* s);
- basic_string& replace(size_type pos, size_type n1, size_type n2, value_type c);
- basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str);
+ size_type pos2, size_type n); // C++17, constexpr since C++20
+ basic_string& replace(size_type pos, size_type n1, const value_type* s, size_type n2); // constexpr since C++20
+ basic_string& replace(size_type pos, size_type n1, const value_type* s); // constexpr since C++20
+ basic_string& replace(size_type pos, size_type n1, size_type n2, value_type c); // constexpr since C++20
+ basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str); // constexpr since C++20
template <class T>
- basic_string& replace(const_iterator i1, const_iterator i2, const T& t); // C++17
- basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s, size_type n);
- basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s);
- basic_string& replace(const_iterator i1, const_iterator i2, size_type n, value_type c);
+ basic_string& replace(const_iterator i1, const_iterator i2, const T& t); // C++17, constexpr since C++20
+ basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s, size_type n); // constexpr since C++20
+ basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s); // constexpr since C++20
+ basic_string& replace(const_iterator i1, const_iterator i2, size_type n, value_type c); // constexpr since C++20
template<class InputIterator>
- basic_string& replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2);
- basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<value_type>);
+ basic_string& replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2); // constexpr since C++20
+ basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<value_type>); // constexpr since C++20
- size_type copy(value_type* s, size_type n, size_type pos = 0) const;
- basic_string substr(size_type pos = 0, size_type n = npos) const;
+ size_type copy(value_type* s, size_type n, size_type pos = 0) const; // constexpr since C++20
+ basic_string substr(size_type pos = 0, size_type n = npos) const; // constexpr since C++20
void swap(basic_string& str)
noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value ||
- allocator_traits<allocator_type>::is_always_equal::value); // C++17
+ allocator_traits<allocator_type>::is_always_equal::value); // C++17, constexpr since C++20
- const value_type* c_str() const noexcept;
- const value_type* data() const noexcept;
- value_type* data() noexcept; // C++17
+ const value_type* c_str() const noexcept; // constexpr since C++20
+ const value_type* data() const noexcept; // constexpr since C++20
+ value_type* data() noexcept; // C++17, constexpr since C++20
- allocator_type get_allocator() const noexcept;
+ allocator_type get_allocator() const noexcept; // constexpr since C++20
- size_type find(const basic_string& str, size_type pos = 0) const noexcept;
+ size_type find(const basic_string& str, size_type pos = 0) const noexcept; // constexpr since C++20
template <class T>
- size_type find(const T& t, size_type pos = 0) const noexcept; // C++17, noexcept as an extension
- size_type find(const value_type* s, size_type pos, size_type n) const noexcept;
- size_type find(const value_type* s, size_type pos = 0) const noexcept;
- size_type find(value_type c, size_type pos = 0) const noexcept;
+ size_type find(const T& t, size_type pos = 0) const noexcept; // C++17, noexcept as an extension, constexpr since C++20
+ size_type find(const value_type* s, size_type pos, size_type n) const noexcept; // constexpr since C++20
+ size_type find(const value_type* s, size_type pos = 0) const noexcept; // constexpr since C++20
+ size_type find(value_type c, size_type pos = 0) const noexcept; // constexpr since C++20
- size_type rfind(const basic_string& str, size_type pos = npos) const noexcept;
+ size_type rfind(const basic_string& str, size_type pos = npos) const noexcept; // constexpr since C++20
template <class T>
- size_type rfind(const T& t, size_type pos = npos) const noexcept; // C++17, noexcept as an extension
- size_type rfind(const value_type* s, size_type pos, size_type n) const noexcept;
- size_type rfind(const value_type* s, size_type pos = npos) const noexcept;
- size_type rfind(value_type c, size_type pos = npos) const noexcept;
+ size_type rfind(const T& t, size_type pos = npos) const noexcept; // C++17, noexcept as an extension, constexpr since C++20
+ size_type rfind(const value_type* s, size_type pos, size_type n) const noexcept; // constexpr since C++20
+ size_type rfind(const value_type* s, size_type pos = npos) const noexcept; // constexpr since C++20
+ size_type rfind(value_type c, size_type pos = npos) const noexcept; // constexpr since C++20
- size_type find_first_of(const basic_string& str, size_type pos = 0) const noexcept;
+ size_type find_first_of(const basic_string& str, size_type pos = 0) const noexcept; // constexpr since C++20
template <class T>
- size_type find_first_of(const T& t, size_type pos = 0) const noexcept; // C++17, noexcept as an extension
- size_type find_first_of(const value_type* s, size_type pos, size_type n) const noexcept;
- size_type find_first_of(const value_type* s, size_type pos = 0) const noexcept;
- size_type find_first_of(value_type c, size_type pos = 0) const noexcept;
+ size_type find_first_of(const T& t, size_type pos = 0) const noexcept; // C++17, noexcept as an extension, constexpr since C++20
+ size_type find_first_of(const value_type* s, size_type pos, size_type n) const noexcept; // constexpr since C++20
+ size_type find_first_of(const value_type* s, size_type pos = 0) const noexcept; // constexpr since C++20
+ size_type find_first_of(value_type c, size_type pos = 0) const noexcept; // constexpr since C++20
- size_type find_last_of(const basic_string& str, size_type pos = npos) const noexcept;
+ size_type find_last_of(const basic_string& str, size_type pos = npos) const noexcept; // constexpr since C++20
template <class T>
- size_type find_last_of(const T& t, size_type pos = npos) const noexcept noexcept; // C++17, noexcept as an extension
- size_type find_last_of(const value_type* s, size_type pos, size_type n) const noexcept;
- size_type find_last_of(const value_type* s, size_type pos = npos) const noexcept;
- size_type find_last_of(value_type c, size_type pos = npos) const noexcept;
+ size_type find_last_of(const T& t, size_type pos = npos) const noexcept noexcept; // C++17, noexcept as an extension, constexpr since C++20
+ size_type find_last_of(const value_type* s, size_type pos, size_type n) const noexcept; // constexpr since C++20
+ size_type find_last_of(const value_type* s, size_type pos = npos) const noexcept; // constexpr since C++20
+ size_type find_last_of(value_type c, size_type pos = npos) const noexcept; // constexpr since C++20
- size_type find_first_not_of(const basic_string& str, size_type pos = 0) const noexcept;
+ size_type find_first_not_of(const basic_string& str, size_type pos = 0) const noexcept; // constexpr since C++20
template <class T>
- size_type find_first_not_of(const T& t, size_type pos = 0) const noexcept; // C++17, noexcept as an extension
- size_type find_first_not_of(const value_type* s, size_type pos, size_type n) const noexcept;
- size_type find_first_not_of(const value_type* s, size_type pos = 0) const noexcept;
- size_type find_first_not_of(value_type c, size_type pos = 0) const noexcept;
+ size_type find_first_not_of(const T& t, size_type pos = 0) const noexcept; // C++17, noexcept as an extension, constexpr since C++20
+ size_type find_first_not_of(const value_type* s, size_type pos, size_type n) const noexcept; // constexpr since C++20
+ size_type find_first_not_of(const value_type* s, size_type pos = 0) const noexcept; // constexpr since C++20
+ size_type find_first_not_of(value_type c, size_type pos = 0) const noexcept; // constexpr since C++20
- size_type find_last_not_of(const basic_string& str, size_type pos = npos) const noexcept;
+ size_type find_last_not_of(const basic_string& str, size_type pos = npos) const noexcept; // constexpr since C++20
template <class T>
- size_type find_last_not_of(const T& t, size_type pos = npos) const noexcept; // C++17, noexcept as an extension
- size_type find_last_not_of(const value_type* s, size_type pos, size_type n) const noexcept;
- size_type find_last_not_of(const value_type* s, size_type pos = npos) const noexcept;
- size_type find_last_not_of(value_type c, size_type pos = npos) const noexcept;
+ size_type find_last_not_of(const T& t, size_type pos = npos) const noexcept; // C++17, noexcept as an extension, constexpr since C++20
+ size_type find_last_not_of(const value_type* s, size_type pos, size_type n) const noexcept; // constexpr since C++20
+ size_type find_last_not_of(const value_type* s, size_type pos = npos) const noexcept; // constexpr since C++20
+ size_type find_last_not_of(value_type c, size_type pos = npos) const noexcept; // constexpr since C++20
- int compare(const basic_string& str) const noexcept;
+ int compare(const basic_string& str) const noexcept; // constexpr since C++20
template <class T>
- int compare(const T& t) const noexcept; // C++17, noexcept as an extension
- int compare(size_type pos1, size_type n1, const basic_string& str) const;
+ int compare(const T& t) const noexcept; // C++17, noexcept as an extension, constexpr since C++20
+ int compare(size_type pos1, size_type n1, const basic_string& str) const; // constexpr since C++20
template <class T>
- int compare(size_type pos1, size_type n1, const T& t) const; // C++17
+ int compare(size_type pos1, size_type n1, const T& t) const; // C++17, constexpr since C++20
int compare(size_type pos1, size_type n1, const basic_string& str,
- size_type pos2, size_type n2=npos) const; // C++14
+ size_type pos2, size_type n2=npos) const; // C++14, constexpr since C++20
template <class T>
int compare(size_type pos1, size_type n1, const T& t,
- size_type pos2, size_type n2=npos) const; // C++17
- int compare(const value_type* s) const noexcept;
- int compare(size_type pos1, size_type n1, const value_type* s) const;
- int compare(size_type pos1, size_type n1, const value_type* s, size_type n2) const;
-
- bool starts_with(basic_string_view<charT, traits> sv) const noexcept; // C++20
- bool starts_with(charT c) const noexcept; // C++20
- bool starts_with(const charT* s) const; // C++20
- bool ends_with(basic_string_view<charT, traits> sv) const noexcept; // C++20
- bool ends_with(charT c) const noexcept; // C++20
- bool ends_with(const charT* s) const; // C++20
-
- constexpr bool contains(basic_string_view<charT, traits> sv) const noexcept; // C++2b
- constexpr bool contains(charT c) const noexcept; // C++2b
- constexpr bool contains(const charT* s) const; // C++2b
-
- bool __invariants() const;
+ size_type pos2, size_type n2=npos) const; // C++17, constexpr since C++20
+ int compare(const value_type* s) const noexcept; // constexpr since C++20
+ int compare(size_type pos1, size_type n1, const value_type* s) const; // constexpr since C++20
+ int compare(size_type pos1, size_type n1, const value_type* s, size_type n2) const; // constexpr since C++20
+
+ constexpr bool starts_with(basic_string_view<charT, traits> sv) const noexcept; // C++20
+ constexpr bool starts_with(charT c) const noexcept; // C++20
+ constexpr bool starts_with(const charT* s) const; // C++20
+ constexpr bool ends_with(basic_string_view<charT, traits> sv) const noexcept; // C++20
+ constexpr bool ends_with(charT c) const noexcept; // C++20
+ constexpr bool ends_with(const charT* s) const; // C++20
+
+ constexpr bool contains(basic_string_view<charT, traits> sv) const noexcept; // C++2b
+ constexpr bool contains(charT c) const noexcept; // C++2b
+ constexpr bool contains(const charT* s) const; // C++2b
};
template<class InputIterator,
@@ -349,88 +347,88 @@ basic_string(InputIterator, InputIterator, Allocator = Allocator())
template<class charT, class traits, class Allocator>
basic_string<charT, traits, Allocator>
operator+(const basic_string<charT, traits, Allocator>& lhs,
- const basic_string<charT, traits, Allocator>& rhs);
+ const basic_string<charT, traits, Allocator>& rhs); // constexpr since C++20
template<class charT, class traits, class Allocator>
basic_string<charT, traits, Allocator>
-operator+(const charT* lhs , const basic_string<charT,traits,Allocator>&rhs);
+operator+(const charT* lhs , const basic_string<charT,traits,Allocator>&rhs); // constexpr since C++20
template<class charT, class traits, class Allocator>
basic_string<charT, traits, Allocator>
-operator+(charT lhs, const basic_string<charT,traits,Allocator>& rhs);
+operator+(charT lhs, const basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20
template<class charT, class traits, class Allocator>
basic_string<charT, traits, Allocator>
-operator+(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs);
+operator+(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs); // constexpr since C++20
template<class charT, class traits, class Allocator>
basic_string<charT, traits, Allocator>
-operator+(const basic_string<charT, traits, Allocator>& lhs, charT rhs);
+operator+(const basic_string<charT, traits, Allocator>& lhs, charT rhs); // constexpr since C++20
template<class charT, class traits, class Allocator>
bool operator==(const basic_string<charT, traits, Allocator>& lhs,
- const basic_string<charT, traits, Allocator>& rhs) noexcept;
+ const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20
template<class charT, class traits, class Allocator>
-bool operator==(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
+bool operator==(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20
template<class charT, class traits, class Allocator>
-bool operator==(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs) noexcept;
+bool operator==(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs) noexcept; // constexpr since C++20
template<class charT, class traits, class Allocator>
bool operator!=(const basic_string<charT,traits,Allocator>& lhs,
- const basic_string<charT, traits, Allocator>& rhs) noexcept;
+ const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20
template<class charT, class traits, class Allocator>
-bool operator!=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
+bool operator!=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20
template<class charT, class traits, class Allocator>
-bool operator!=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
+bool operator!=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept; // constexpr since C++20
template<class charT, class traits, class Allocator>
bool operator< (const basic_string<charT, traits, Allocator>& lhs,
- const basic_string<charT, traits, Allocator>& rhs) noexcept;
+ const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20
template<class charT, class traits, class Allocator>
-bool operator< (const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
+bool operator< (const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept; // constexpr since C++20
template<class charT, class traits, class Allocator>
-bool operator< (const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
+bool operator< (const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20
template<class charT, class traits, class Allocator>
bool operator> (const basic_string<charT, traits, Allocator>& lhs,
- const basic_string<charT, traits, Allocator>& rhs) noexcept;
+ const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20
template<class charT, class traits, class Allocator>
-bool operator> (const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
+bool operator> (const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept; // constexpr since C++20
template<class charT, class traits, class Allocator>
-bool operator> (const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
+bool operator> (const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20
template<class charT, class traits, class Allocator>
bool operator<=(const basic_string<charT, traits, Allocator>& lhs,
- const basic_string<charT, traits, Allocator>& rhs) noexcept;
+ const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20
template<class charT, class traits, class Allocator>
-bool operator<=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
+bool operator<=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept; // constexpr since C++20
template<class charT, class traits, class Allocator>
-bool operator<=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
+bool operator<=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20
template<class charT, class traits, class Allocator>
bool operator>=(const basic_string<charT, traits, Allocator>& lhs,
- const basic_string<charT, traits, Allocator>& rhs) noexcept;
+ const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20
template<class charT, class traits, class Allocator>
-bool operator>=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
+bool operator>=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept; // constexpr since C++20
template<class charT, class traits, class Allocator>
-bool operator>=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
+bool operator>=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20
template<class charT, class traits, class Allocator>
void swap(basic_string<charT, traits, Allocator>& lhs,
basic_string<charT, traits, Allocator>& rhs)
- noexcept(noexcept(lhs.swap(rhs)));
+ noexcept(noexcept(lhs.swap(rhs))); // constexpr since C++20
template<class charT, class traits, class Allocator>
basic_istream<charT, traits>&
@@ -508,11 +506,11 @@ template <> struct hash<u16string>;
template <> struct hash<u32string>;
template <> struct hash<wstring>;
-basic_string<char> operator "" s( const char *str, size_t len ); // C++14
-basic_string<wchar_t> operator "" s( const wchar_t *str, size_t len ); // C++14
-basic_string<char8_t> operator "" s( const char8_t *str, size_t len ); // C++20
-basic_string<char16_t> operator "" s( const char16_t *str, size_t len ); // C++14
-basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); // C++14
+basic_string<char> operator "" s( const char *str, size_t len ); // C++14, constexpr since C++20
+basic_string<wchar_t> operator "" s( const wchar_t *str, size_t len ); // C++14, constexpr since C++20
+constexpr basic_string<char8_t> operator "" s( const char8_t *str, size_t len ); // C++20
+basic_string<char16_t> operator "" s( const char16_t *str, size_t len ); // C++14, constexpr since C++20
+basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); // C++14, constexpr since C++20
} // std
@@ -580,23 +578,27 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template<class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
operator+(const basic_string<_CharT, _Traits, _Allocator>& __x,
const basic_string<_CharT, _Traits, _Allocator>& __y);
template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>
operator+(const _CharT* __x, const basic_string<_CharT,_Traits,_Allocator>& __y);
template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>
operator+(_CharT __x, const basic_string<_CharT,_Traits,_Allocator>& __y);
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>
operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, const _CharT* __y);
template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>
operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y);
@@ -666,8 +668,8 @@ public:
typedef __wrap_iter<pointer> iterator;
typedef __wrap_iter<const_pointer> const_iterator;
- typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
- typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
private:
@@ -770,7 +772,8 @@ private:
// Construct a string with the given allocator and enough storage to hold `__size` characters, but
// don't initialize the characters. The contents of the string, including the null terminator, must be
// initialized separately.
- _LIBCPP_HIDE_FROM_ABI explicit basic_string(__uninitialized_size_tag, size_type __size, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
+ explicit basic_string(__uninitialized_size_tag, size_type __size, const allocator_type& __a)
: __r_(__default_init_tag(), __a) {
if (__size > max_size())
__throw_length_error();
@@ -780,6 +783,7 @@ private:
} else {
auto __capacity = __recommend(__size) + 1;
auto __allocation = __alloc_traits::allocate(__alloc(), __capacity);
+ __begin_lifetime(__allocation, __capacity);
__set_long_cap(__capacity);
__set_long_pointer(__allocation);
__set_long_size(__size);
@@ -791,21 +795,21 @@ public:
_LIBCPP_TEMPLATE_DATA_VIS
static const size_type npos = -1;
- _LIBCPP_INLINE_VISIBILITY basic_string()
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
- _LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a)
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit basic_string(const allocator_type& __a)
#if _LIBCPP_STD_VER <= 14
_NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value);
#else
_NOEXCEPT;
#endif
- basic_string(const basic_string& __str);
- basic_string(const basic_string& __str, const allocator_type& __a);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string(const basic_string& __str);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string(const basic_string& __str, const allocator_type& __a);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string(basic_string&& __str)
#if _LIBCPP_STD_VER <= 14
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
@@ -813,12 +817,12 @@ public:
_NOEXCEPT;
#endif
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string(basic_string&& __str, const allocator_type& __a);
#endif // _LIBCPP_CXX03_LANG
template <class = __enable_if_t<__is_allocator<_Allocator>::value, nullptr_t> >
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string(const _CharT* __s) : __r_(__default_init_tag(), __default_init_tag()) {
_LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr");
__init(__s, traits_type::length(__s));
@@ -826,146 +830,151 @@ public:
}
template <class = __enable_if_t<__is_allocator<_Allocator>::value, nullptr_t> >
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string(const _CharT* __s, const _Allocator& __a);
#if _LIBCPP_STD_VER > 20
basic_string(nullptr_t) = delete;
#endif
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string(const _CharT* __s, size_type __n);
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string(const _CharT* __s, size_type __n, const _Allocator& __a);
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string(size_type __n, _CharT __c);
template <class = __enable_if_t<__is_allocator<_Allocator>::value, nullptr_t> >
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string(size_type __n, _CharT __c, const _Allocator& __a);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string(const basic_string& __str, size_type __pos, size_type __n,
const _Allocator& __a = _Allocator());
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string(const basic_string& __str, size_type __pos,
const _Allocator& __a = _Allocator());
template<class _Tp, class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value> >
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string(const _Tp& __t, size_type __pos, size_type __n,
const allocator_type& __a = allocator_type());
template<class _Tp, class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
!__is_same_uncvref<_Tp, basic_string>::value> >
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
explicit basic_string(const _Tp& __t);
template<class _Tp, class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value> >
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
explicit basic_string(const _Tp& __t, const allocator_type& __a);
template<class _InputIterator, class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value> >
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string(_InputIterator __first, _InputIterator __last);
template<class _InputIterator, class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value> >
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string(initializer_list<_CharT> __il);
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string(initializer_list<_CharT> __il, const _Allocator& __a);
#endif // _LIBCPP_CXX03_LANG
- inline ~basic_string();
+ inline _LIBCPP_CONSTEXPR_AFTER_CXX17 ~basic_string();
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); }
- basic_string& operator=(const basic_string& __str);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator=(const basic_string& __str);
- template <class _Tp, class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value> >
- basic_string& operator=(const _Tp& __t)
- {__self_view __sv = __t; return assign(__sv);}
+ template <class _Tp, class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
+ !__is_same_uncvref<_Tp, basic_string>::value> >
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator=(const _Tp& __t) {
+ __self_view __sv = __t;
+ return assign(__sv);
+ }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string& operator=(basic_string&& __str)
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string& operator=(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
#endif
- _LIBCPP_INLINE_VISIBILITY basic_string& operator=(const value_type* __s) {return assign(__s);}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ basic_string& operator=(const value_type* __s) {return assign(__s);}
#if _LIBCPP_STD_VER > 20
basic_string& operator=(nullptr_t) = delete;
#endif
- basic_string& operator=(value_type __c);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator=(value_type __c);
#if _LIBCPP_DEBUG_LEVEL == 2
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
iterator begin() _NOEXCEPT
{return iterator(this, __get_pointer());}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
const_iterator begin() const _NOEXCEPT
{return const_iterator(this, __get_pointer());}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
iterator end() _NOEXCEPT
{return iterator(this, __get_pointer() + size());}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
const_iterator end() const _NOEXCEPT
{return const_iterator(this, __get_pointer() + size());}
#else
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
iterator begin() _NOEXCEPT
{return iterator(__get_pointer());}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
const_iterator begin() const _NOEXCEPT
{return const_iterator(__get_pointer());}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
iterator end() _NOEXCEPT
{return iterator(__get_pointer() + size());}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
const_iterator end() const _NOEXCEPT
{return const_iterator(__get_pointer() + size());}
#endif // _LIBCPP_DEBUG_LEVEL == 2
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
reverse_iterator rbegin() _NOEXCEPT
{return reverse_iterator(end());}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
const_reverse_iterator rbegin() const _NOEXCEPT
{return const_reverse_iterator(end());}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
reverse_iterator rend() _NOEXCEPT
{return reverse_iterator(begin());}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
const_reverse_iterator rend() const _NOEXCEPT
{return const_reverse_iterator(begin());}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
const_iterator cbegin() const _NOEXCEPT
{return begin();}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
const_iterator cend() const _NOEXCEPT
{return end();}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
const_reverse_iterator crbegin() const _NOEXCEPT
{return rbegin();}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
const_reverse_iterator crend() const _NOEXCEPT
{return rend();}
- _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type size() const _NOEXCEPT
{return __is_long() ? __get_long_size() : __get_short_size();}
- _LIBCPP_INLINE_VISIBILITY size_type length() const _NOEXCEPT {return size();}
- _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY size_type capacity() const _NOEXCEPT
- {return (__is_long() ? __get_long_cap()
- : static_cast<size_type>(__min_cap)) - 1;}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type length() const _NOEXCEPT {return size();}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type max_size() const _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type capacity() const _NOEXCEPT {
+ return (__is_long() ? __get_long_cap() : static_cast<size_type>(__min_cap)) - 1;
+ }
- void resize(size_type __n, value_type __c);
- _LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());}
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 void resize(size_type __n, value_type __c);
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void resize(size_type __n) { resize(__n, value_type()); }
- void reserve(size_type __requested_capacity);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 void reserve(size_type __requested_capacity);
#if _LIBCPP_STD_VER > 20
template <class _Op>
@@ -976,55 +985,67 @@ public:
}
#endif
- _LIBCPP_INLINE_VISIBILITY void __resize_default_init(size_type __n);
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void __resize_default_init(size_type __n);
- _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_INLINE_VISIBILITY
- void reserve() _NOEXCEPT {shrink_to_fit();}
- _LIBCPP_INLINE_VISIBILITY
- void shrink_to_fit() _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY
- void clear() _NOEXCEPT;
- _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_INLINE_VISIBILITY void reserve() _NOEXCEPT { shrink_to_fit(); }
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void shrink_to_fit() _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void clear() _NOEXCEPT;
+
+ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
bool empty() const _NOEXCEPT {return size() == 0;}
- _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __pos) const _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __pos) _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ const_reference operator[](size_type __pos) const _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 reference operator[](size_type __pos) _NOEXCEPT;
- const_reference at(size_type __n) const;
- reference at(size_type __n);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 const_reference at(size_type __n) const;
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 reference at(size_type __n);
- _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const basic_string& __str) {return append(__str);}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator+=(const basic_string& __str) {
+ return append(__str);
+ }
template <class _Tp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value
&& !__is_same_uncvref<_Tp, basic_string >::value,
basic_string&
>
- operator+=(const _Tp& __t) {__self_view __sv = __t; return append(__sv);}
- _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const value_type* __s) {return append(__s);}
- _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(value_type __c) {push_back(__c); return *this;}
+ operator+=(const _Tp& __t) {
+ __self_view __sv = __t; return append(__sv);
+ }
+
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator+=(const value_type* __s) {
+ return append(__s);
+ }
+
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator+=(value_type __c) {
+ push_back(__c);
+ return *this;
+ }
+
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(initializer_list<value_type> __il) {return append(__il);}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ basic_string& operator+=(initializer_list<value_type> __il) { return append(__il); }
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string& append(const basic_string& __str);
template <class _Tp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value
&& !__is_same_uncvref<_Tp, basic_string>::value,
basic_string&
>
append(const _Tp& __t) { __self_view __sv = __t; return append(__sv.data(), __sv.size()); }
- basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos);
template <class _Tp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value
@@ -1032,11 +1053,11 @@ public:
basic_string&
>
append(const _Tp& __t, size_type __pos, size_type __n=npos);
- basic_string& append(const value_type* __s, size_type __n);
- basic_string& append(const value_type* __s);
- basic_string& append(size_type __n, value_type __c);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& append(const value_type* __s, size_type __n);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& append(const value_type* __s);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& append(size_type __n, value_type __c);
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void __append_default_init(size_type __n);
template<class _InputIterator>
@@ -1046,7 +1067,7 @@ public:
__is_exactly_cpp17_input_iterator<_InputIterator>::value,
basic_string&
>
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
append(_InputIterator __first, _InputIterator __last) {
const basic_string __temp(__first, __last, __alloc());
append(__temp.data(), __temp.size());
@@ -1059,41 +1080,40 @@ public:
__is_cpp17_forward_iterator<_ForwardIterator>::value,
basic_string&
>
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
append(_ForwardIterator __first, _ForwardIterator __last);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string& append(initializer_list<value_type> __il) {return append(__il.begin(), __il.size());}
#endif // _LIBCPP_CXX03_LANG
- void push_back(value_type __c);
- _LIBCPP_INLINE_VISIBILITY
- void pop_back();
- _LIBCPP_INLINE_VISIBILITY reference front() _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY const_reference front() const _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY reference back() _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY const_reference back() const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 void push_back(value_type __c);
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void pop_back();
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 reference front() _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 const_reference front() const _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 reference back() _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 const_reference back() const _NOEXCEPT;
template <class _Tp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
basic_string&
>
assign(const _Tp & __t) { __self_view __sv = __t; return assign(__sv.data(), __sv.size()); }
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string& assign(const basic_string& __str) { return *this = __str; }
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string& assign(basic_string&& __str)
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
{*this = _VSTD::move(__str); return *this;}
#endif
- basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos);
template <class _Tp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value
@@ -1101,11 +1121,11 @@ public:
basic_string&
>
assign(const _Tp & __t, size_type __pos, size_type __n=npos);
- basic_string& assign(const value_type* __s, size_type __n);
- basic_string& assign(const value_type* __s);
- basic_string& assign(size_type __n, value_type __c);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& assign(const value_type* __s, size_type __n);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& assign(const value_type* __s);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& assign(size_type __n, value_type __c);
template<class _InputIterator>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__is_exactly_cpp17_input_iterator<_InputIterator>::value,
@@ -1113,7 +1133,7 @@ public:
>
assign(_InputIterator __first, _InputIterator __last);
template<class _ForwardIterator>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__is_cpp17_forward_iterator<_ForwardIterator>::value,
@@ -1121,15 +1141,15 @@ public:
>
assign(_ForwardIterator __first, _ForwardIterator __last);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string& assign(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string& insert(size_type __pos1, const basic_string& __str);
template <class _Tp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -1139,22 +1159,23 @@ public:
{ __self_view __sv = __t; return insert(__pos1, __sv.data(), __sv.size()); }
template <class _Tp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value,
basic_string&
>
insert(size_type __pos1, const _Tp& __t, size_type __pos2, size_type __n=npos);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n=npos);
- basic_string& insert(size_type __pos, const value_type* __s, size_type __n);
- basic_string& insert(size_type __pos, const value_type* __s);
- basic_string& insert(size_type __pos, size_type __n, value_type __c);
- iterator insert(const_iterator __pos, value_type __c);
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& insert(size_type __pos, const value_type* __s, size_type __n);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& insert(size_type __pos, const value_type* __s);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& insert(size_type __pos, size_type __n, value_type __c);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator insert(const_iterator __pos, value_type __c);
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
iterator insert(const_iterator __pos, size_type __n, value_type __c);
template<class _InputIterator>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__is_exactly_cpp17_input_iterator<_InputIterator>::value,
@@ -1162,7 +1183,7 @@ public:
>
insert(const_iterator __pos, _InputIterator __first, _InputIterator __last);
template<class _ForwardIterator>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__is_cpp17_forward_iterator<_ForwardIterator>::value,
@@ -1170,45 +1191,47 @@ public:
>
insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
iterator insert(const_iterator __pos, initializer_list<value_type> __il)
{return insert(__pos, __il.begin(), __il.end());}
#endif // _LIBCPP_CXX03_LANG
- basic_string& erase(size_type __pos = 0, size_type __n = npos);
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& erase(size_type __pos = 0, size_type __n = npos);
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
iterator erase(const_iterator __pos);
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
iterator erase(const_iterator __first, const_iterator __last);
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str);
template <class _Tp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
basic_string&
>
replace(size_type __pos1, size_type __n1, const _Tp& __t) { __self_view __sv = __t; return replace(__pos1, __n1, __sv.data(), __sv.size()); }
+ _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos);
template <class _Tp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value,
basic_string&
>
replace(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2=npos);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string& replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2);
- basic_string& replace(size_type __pos, size_type __n1, const value_type* __s);
- basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c);
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& replace(size_type __pos, size_type __n1, const value_type* __s);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c);
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string& replace(const_iterator __i1, const_iterator __i2, const basic_string& __str);
template <class _Tp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -1216,14 +1239,14 @@ public:
>
replace(const_iterator __i1, const_iterator __i2, const _Tp& __t) { __self_view __sv = __t; return replace(__i1 - begin(), __i2 - __i1, __sv); }
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n);
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s);
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c);
template<class _InputIterator>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__is_cpp17_input_iterator<_InputIterator>::value,
@@ -1231,16 +1254,16 @@ public:
>
replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string& replace(const_iterator __i1, const_iterator __i2, initializer_list<value_type> __il)
{return replace(__i1, __i2, __il.begin(), __il.end());}
#endif // _LIBCPP_CXX03_LANG
- size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const;
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string substr(size_type __pos = 0, size_type __n = npos) const;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void swap(basic_string& __str)
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT;
@@ -1249,123 +1272,129 @@ public:
__is_nothrow_swappable<allocator_type>::value);
#endif
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
const value_type* c_str() const _NOEXCEPT {return data();}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
const value_type* data() const _NOEXCEPT {return _VSTD::__to_address(__get_pointer());}
#if _LIBCPP_STD_VER > 14 || defined(_LIBCPP_BUILDING_LIBRARY)
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
value_type* data() _NOEXCEPT {return _VSTD::__to_address(__get_pointer());}
#endif
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
allocator_type get_allocator() const _NOEXCEPT {return __alloc();}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
template <class _Tp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
size_type
>
find(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type find(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
- size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
template <class _Tp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
size_type
>
rfind(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type rfind(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
- size_type rfind(value_type __c, size_type __pos = npos) const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type rfind(value_type __c, size_type __pos = npos) const _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
template <class _Tp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
size_type
>
find_first_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type find_first_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type find_first_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
template <class _Tp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
size_type
>
find_last_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type find_last_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type find_last_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
template <class _Tp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
size_type
>
find_first_not_of(const _Tp &__t, size_type __pos = 0) const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type find_first_not_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type find_first_not_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
template <class _Tp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
size_type
>
find_last_not_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type find_last_not_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type find_last_not_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
int compare(const basic_string& __str) const _NOEXCEPT;
template <class _Tp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -1374,7 +1403,7 @@ public:
compare(const _Tp &__t) const _NOEXCEPT;
template <class _Tp>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -1382,20 +1411,23 @@ public:
>
compare(size_type __pos1, size_type __n1, const _Tp& __t) const;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
int compare(size_type __pos1, size_type __n1, const basic_string& __str) const;
- int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos) const;
+ _LIBCPP_CONSTEXPR_AFTER_CXX17
+ int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2,
+ size_type __n2 = npos) const;
template <class _Tp>
- inline _LIBCPP_INLINE_VISIBILITY
+ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value,
int
>
compare(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2=npos) const;
- int compare(const value_type* __s) const _NOEXCEPT;
- int compare(size_type __pos1, size_type __n1, const value_type* __s) const;
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 int compare(const value_type* __s) const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 int compare(size_type __pos1, size_type __n1, const value_type* __s) const;
+ _LIBCPP_CONSTEXPR_AFTER_CXX17
int compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const;
#if _LIBCPP_STD_VER > 17
@@ -1438,16 +1470,9 @@ public:
{ return __self_view(data(), size()).contains(__s); }
#endif
- _LIBCPP_INLINE_VISIBILITY bool __invariants() const;
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool __invariants() const;
- _LIBCPP_INLINE_VISIBILITY void __clear_and_shrink() _NOEXCEPT;
-
- _LIBCPP_INLINE_VISIBILITY void __shrink_or_extend(size_type __target_capacity);
-
- _LIBCPP_INLINE_VISIBILITY
- bool __is_long() const _NOEXCEPT {
- return __r_.first().__s.__is_long_;
- }
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void __clear_and_shrink() _NOEXCEPT;
#if _LIBCPP_DEBUG_LEVEL == 2
@@ -1459,6 +1484,49 @@ public:
#endif // _LIBCPP_DEBUG_LEVEL == 2
private:
+ template<class _Alloc>
+ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ bool friend operator==(const basic_string<char, char_traits<char>, _Alloc>& __lhs,
+ const basic_string<char, char_traits<char>, _Alloc>& __rhs) _NOEXCEPT;
+
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void __shrink_or_extend(size_type __target_capacity);
+
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ bool __is_long() const _NOEXCEPT {
+ if (__libcpp_is_constant_evaluated())
+ return true;
+ return __r_.first().__s.__is_long_;
+ }
+
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __begin_lifetime(pointer __begin, size_type __n) {
+#if _LIBCPP_STD_VER > 17
+ if (__libcpp_is_constant_evaluated()) {
+ for (size_type __i = 0; __i != __n; ++__i)
+ std::construct_at(std::addressof(__begin[__i]));
+ }
+#else
+ (void)__begin;
+ (void)__n;
+#endif // _LIBCPP_STD_VER > 17
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __default_init() {
+ __zero();
+ if (__libcpp_is_constant_evaluated()) {
+ size_type __sz = __recommend(0) + 1;
+ pointer __ptr = __alloc_traits::allocate(__alloc(), __sz);
+ __begin_lifetime(__ptr, __sz);
+ __set_long_pointer(__ptr);
+ __set_long_cap(__sz);
+ __set_long_size(0);
+ }
+ }
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __deallocate_constexpr() {
+ if (__libcpp_is_constant_evaluated() && __get_pointer() != nullptr)
+ __alloc_traits::deallocate(__alloc(), __get_pointer(), __get_long_cap());
+ }
+
_LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI static bool __fits_in_sso(size_type __sz) {
// SSO is disabled during constant evaluation because `__is_long` isn't constexpr friendly
return !__libcpp_is_constant_evaluated() && (__sz < __min_cap);
@@ -1491,93 +1559,95 @@ private:
return begin() + __ip;
}
- _LIBCPP_HIDE_FROM_ABI allocator_type& __alloc() _NOEXCEPT { return __r_.second(); }
- _LIBCPP_HIDE_FROM_ABI const allocator_type& __alloc() const _NOEXCEPT { return __r_.second(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 allocator_type& __alloc() _NOEXCEPT { return __r_.second(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const allocator_type& __alloc() const _NOEXCEPT { return __r_.second(); }
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void __set_short_size(size_type __s) _NOEXCEPT {
_LIBCPP_ASSERT(__s < __min_cap, "__s should never be greater than or equal to the short string capacity");
__r_.first().__s.__size_ = __s;
__r_.first().__s.__is_long_ = false;
}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type __get_short_size() const _NOEXCEPT {
_LIBCPP_ASSERT(!__r_.first().__s.__is_long_, "String has to be short when trying to get the short size");
return __r_.first().__s.__size_;
}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void __set_long_size(size_type __s) _NOEXCEPT
{__r_.first().__l.__size_ = __s;}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type __get_long_size() const _NOEXCEPT
{return __r_.first().__l.__size_;}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void __set_size(size_type __s) _NOEXCEPT
{if (__is_long()) __set_long_size(__s); else __set_short_size(__s);}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void __set_long_cap(size_type __s) _NOEXCEPT {
__r_.first().__l.__cap_ = __s / __endian_factor;
__r_.first().__l.__is_long_ = true;
}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type __get_long_cap() const _NOEXCEPT {
return __r_.first().__l.__cap_ * __endian_factor;
}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void __set_long_pointer(pointer __p) _NOEXCEPT
{__r_.first().__l.__data_ = __p;}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
pointer __get_long_pointer() _NOEXCEPT
{return __r_.first().__l.__data_;}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
const_pointer __get_long_pointer() const _NOEXCEPT
{return __r_.first().__l.__data_;}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
pointer __get_short_pointer() _NOEXCEPT
{return pointer_traits<pointer>::pointer_to(__r_.first().__s.__data_[0]);}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
const_pointer __get_short_pointer() const _NOEXCEPT
{return pointer_traits<const_pointer>::pointer_to(__r_.first().__s.__data_[0]);}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
pointer __get_pointer() _NOEXCEPT
{return __is_long() ? __get_long_pointer() : __get_short_pointer();}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
const_pointer __get_pointer() const _NOEXCEPT
{return __is_long() ? __get_long_pointer() : __get_short_pointer();}
- _LIBCPP_INLINE_VISIBILITY
- void __zero() _NOEXCEPT
- {
- size_type (&__a)[__n_words] = __r_.first().__r.__words;
- for (unsigned __i = 0; __i < __n_words; ++__i)
- __a[__i] = 0;
- }
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+ void __zero() _NOEXCEPT {
+ __r_.first() = __rep();
+ }
template <size_type __a> static
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type __align_it(size_type __s) _NOEXCEPT
{return (__s + (__a-1)) & ~(__a-1);}
enum {__alignment = 16};
- static _LIBCPP_INLINE_VISIBILITY
+ static _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
size_type __recommend(size_type __s) _NOEXCEPT
- {
- if (__s < __min_cap) return static_cast<size_type>(__min_cap) - 1;
+ {
+ if (__s < __min_cap) {
+ if (__libcpp_is_constant_evaluated())
+ return static_cast<size_type>(__min_cap);
+ else
+ return static_cast<size_type>(__min_cap) - 1;
+ }
size_type __guess = __align_it<sizeof(value_type) < __alignment ?
__alignment/sizeof(value_type) : 1 > (__s+1) - 1;
if (__guess == __min_cap) ++__guess;
return __guess;
- }
+ }
- inline
+ inline _LIBCPP_CONSTEXPR_AFTER_CXX17
void __init(const value_type* __s, size_type __sz, size_type __reserve);
- inline
+ inline _LIBCPP_CONSTEXPR_AFTER_CXX17
void __init(const value_type* __s, size_type __sz);
- inline
+ inline _LIBCPP_CONSTEXPR_AFTER_CXX17
void __init(size_type __n, value_type __c);
// Slow path for the (inlined) copy constructor for 'long' strings.
@@ -1588,10 +1658,10 @@ private:
// to call the __init() functions as those are marked as inline which may
// result in over-aggressive inlining by the compiler, where our aim is
// to only inline the fast path code directly in the ctor.
- void __init_copy_ctor_external(const value_type* __s, size_type __sz);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 void __init_copy_ctor_external(const value_type* __s, size_type __sz);
template <class _InputIterator>
- inline
+ inline _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__is_exactly_cpp17_input_iterator<_InputIterator>::value
@@ -1599,15 +1669,17 @@ private:
__init(_InputIterator __first, _InputIterator __last);
template <class _ForwardIterator>
- inline
+ inline _LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__is_cpp17_forward_iterator<_ForwardIterator>::value
>
__init(_ForwardIterator __first, _ForwardIterator __last);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17
void __grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
size_type __n_copy, size_type __n_del, size_type __n_add = 0);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17
void __grow_by_and_replace(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
size_type __n_copy, size_type __n_del,
size_type __n_add, const value_type* __p_new_stuff);
@@ -1616,21 +1688,21 @@ private:
// have proof that the input does not alias the current instance.
// For example, operator=(basic_string) performs a 'self' check.
template <bool __is_short>
- basic_string& __assign_no_alias(const value_type* __s, size_type __n);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& __assign_no_alias(const value_type* __s, size_type __n);
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void __erase_to_end(size_type __pos);
// __erase_external_with_move is invoked for erase() invocations where
// `n ~= npos`, likely requiring memory moves on the string data.
- void __erase_external_with_move(size_type __pos, size_type __n);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 void __erase_external_with_move(size_type __pos, size_type __n);
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void __copy_assign_alloc(const basic_string& __str)
{__copy_assign_alloc(__str, integral_constant<bool,
__alloc_traits::propagate_on_container_copy_assignment::value>());}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void __copy_assign_alloc(const basic_string& __str, true_type)
{
if (__alloc() == __str.__alloc())
@@ -1646,6 +1718,7 @@ private:
{
allocator_type __a = __str.__alloc();
auto __allocation = std::__allocate_at_least(__a, __str.__get_long_cap());
+ __begin_lifetime(__allocation.ptr, __allocation.count);
__clear_and_shrink();
__alloc() = _VSTD::move(__a);
__set_long_pointer(__allocation.ptr);
@@ -1655,15 +1728,15 @@ private:
}
}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT
{}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void __move_assign(basic_string& __str, false_type)
_NOEXCEPT_(__alloc_traits::is_always_equal::value);
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void __move_assign(basic_string& __str, true_type)
#if _LIBCPP_STD_VER > 14
_NOEXCEPT;
@@ -1672,7 +1745,7 @@ private:
#endif
#endif
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void
__move_assign_alloc(basic_string& __str)
_NOEXCEPT_(
@@ -1681,20 +1754,20 @@ private:
{__move_assign_alloc(__str, integral_constant<bool,
__alloc_traits::propagate_on_container_move_assignment::value>());}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void __move_assign_alloc(basic_string& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
{
__alloc() = _VSTD::move(__c.__alloc());
}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void __move_assign_alloc(basic_string&, false_type)
_NOEXCEPT
{}
- basic_string& __assign_external(const value_type* __s);
- basic_string& __assign_external(const value_type* __s, size_type __n);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& __assign_external(const value_type* __s);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& __assign_external(const value_type* __s, size_type __n);
// Assigns the value in __s, guaranteed to be __n < __min_cap in length.
inline basic_string& __assign_short(const value_type* __s, size_type __n) {
@@ -1706,19 +1779,23 @@ private:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI basic_string& __null_terminate_at(value_type* __p, size_type __newsz) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
+ basic_string& __null_terminate_at(value_type* __p, size_type __newsz) {
__set_size(__newsz);
__invalidate_iterators_past(__newsz);
traits_type::assign(__p[__newsz], value_type());
return *this;
}
- _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
- _LIBCPP_INLINE_VISIBILITY void __invalidate_iterators_past(size_type);
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void __invalidate_all_iterators();
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void __invalidate_iterators_past(size_type);
template<class _Tp>
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
bool __addr_in_range(_Tp&& __t) const {
+ // assume that the ranges overlap, because we can't check during constant evaluation
+ if (__libcpp_is_constant_evaluated())
+ return true;
const volatile void *__p = _VSTD::addressof(__t);
return data() <= __p && __p <= data() + size();
}
@@ -1733,11 +1810,11 @@ private:
_VSTD::__throw_out_of_range("basic_string");
}
- friend basic_string operator+<>(const basic_string&, const basic_string&);
- friend basic_string operator+<>(const value_type*, const basic_string&);
- friend basic_string operator+<>(value_type, const basic_string&);
- friend basic_string operator+<>(const basic_string&, const value_type*);
- friend basic_string operator+<>(const basic_string&, value_type);
+ friend _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator+<>(const basic_string&, const basic_string&);
+ friend _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator+<>(const value_type*, const basic_string&);
+ friend _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator+<>(value_type, const basic_string&);
+ friend _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator+<>(const basic_string&, const value_type*);
+ friend _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator+<>(const basic_string&, value_type);
};
// These declarations must appear before any functions are implicitly used
@@ -1784,7 +1861,7 @@ basic_string(basic_string_view<_CharT, _Traits>, _Sz, _Sz, const _Allocator& = _
#endif
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::__invalidate_all_iterators()
{
@@ -1795,7 +1872,7 @@ basic_string<_CharT, _Traits, _Allocator>::__invalidate_all_iterators()
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type __pos)
{
@@ -1825,17 +1902,17 @@ basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __r_(__default_init_tag(), __default_init_tag())
{
- _VSTD::__debug_db_insert_c(this);
- __zero();
+ std::__debug_db_insert_c(this);
+ __default_init();
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __a)
#if _LIBCPP_STD_VER <= 14
_NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
@@ -1844,15 +1921,18 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __
#endif
: __r_(__default_init_tag(), __a)
{
- _VSTD::__debug_db_insert_c(this);
- __zero();
+ std::__debug_db_insert_c(this);
+ __default_init();
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s,
size_type __sz,
size_type __reserve)
{
+ if (__libcpp_is_constant_evaluated())
+ __zero();
if (__reserve > max_size())
__throw_length_error();
pointer __p;
@@ -1865,6 +1945,7 @@ void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s,
{
auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__reserve) + 1);
__p = __allocation.ptr;
+ __begin_lifetime(__p, __allocation.count);
__set_long_pointer(__p);
__set_long_cap(__allocation.count);
__set_long_size(__sz);
@@ -1874,9 +1955,12 @@ void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s,
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz)
{
+ if (__libcpp_is_constant_evaluated())
+ __zero();
if (__sz > max_size())
__throw_length_error();
pointer __p;
@@ -1889,6 +1973,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty
{
auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__sz) + 1);
__p = __allocation.ptr;
+ __begin_lifetime(__p, __allocation.count);
__set_long_pointer(__p);
__set_long_cap(__allocation.count);
__set_long_size(__sz);
@@ -1899,6 +1984,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty
template <class _CharT, class _Traits, class _Allocator>
template <class>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a)
: __r_(__default_init_tag(), __a)
{
@@ -1908,7 +1994,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n)
: __r_(__default_init_tag(), __default_init_tag())
{
@@ -1918,7 +2004,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n, const _Allocator& __a)
: __r_(__default_init_tag(), __a)
{
@@ -1928,6 +2014,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str)
: __r_(__default_init_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc()))
{
@@ -1940,6 +2027,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string(
const basic_string& __str, const allocator_type& __a)
: __r_(__default_init_tag(), __a)
@@ -1953,8 +2041,11 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
void basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(
const value_type* __s, size_type __sz) {
+ if (__libcpp_is_constant_evaluated())
+ __zero();
pointer __p;
if (__fits_in_sso(__sz)) {
__p = __get_short_pointer();
@@ -1964,17 +2055,18 @@ void basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(
__throw_length_error();
auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__sz) + 1);
__p = __allocation.ptr;
+ __begin_lifetime(__p, __allocation.count);
__set_long_pointer(__p);
__set_long_cap(__allocation.count);
__set_long_size(__sz);
}
- traits_type::copy(_VSTD::__to_address(__p), __s, __sz + 1);
+ traits_type::copy(std::__to_address(__p), __s, __sz + 1);
}
#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
#if _LIBCPP_STD_VER <= 14
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
@@ -1983,7 +2075,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
#endif
: __r_(_VSTD::move(__str.__r_))
{
- __str.__zero();
+ __str.__default_init();
_VSTD::__debug_db_insert_c(this);
#if _LIBCPP_DEBUG_LEVEL == 2
if (!__libcpp_is_constant_evaluated() && __is_long())
@@ -1992,7 +2084,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a)
: __r_(__default_init_tag(), __a)
{
@@ -2000,8 +2092,13 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, co
__init(_VSTD::__to_address(__str.__get_long_pointer()), __str.__get_long_size());
else
{
- __r_.first().__r = __str.__r_.first().__r;
- __str.__zero();
+ if (__libcpp_is_constant_evaluated()) {
+ __zero();
+ __r_.first().__l = __str.__r_.first().__l;
+ } else {
+ __r_.first().__r = __str.__r_.first().__r;
+ }
+ __str.__default_init();
}
_VSTD::__debug_db_insert_c(this);
#if _LIBCPP_DEBUG_LEVEL == 2
@@ -2013,9 +2110,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, co
#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)
{
+ if (__libcpp_is_constant_evaluated())
+ __zero();
if (__n > max_size())
__throw_length_error();
pointer __p;
@@ -2028,6 +2128,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)
{
auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__n) + 1);
__p = __allocation.ptr;
+ __begin_lifetime(__p, __allocation.count);
__set_long_pointer(__p);
__set_long_cap(__allocation.count);
__set_long_size(__n);
@@ -2037,7 +2138,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c)
: __r_(__default_init_tag(), __default_init_tag())
{
@@ -2047,6 +2148,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __
template <class _CharT, class _Traits, class _Allocator>
template <class>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a)
: __r_(__default_init_tag(), __a)
{
@@ -2055,6 +2157,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str,
size_type __pos, size_type __n,
const _Allocator& __a)
@@ -2068,7 +2171,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos,
const _Allocator& __a)
: __r_(__default_init_tag(), __a)
@@ -2082,6 +2185,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, class>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string(
const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a)
: __r_(__default_init_tag(), __a)
@@ -2094,6 +2198,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(
template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, class>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t)
: __r_(__default_init_tag(), __default_init_tag())
{
@@ -2104,6 +2209,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t)
template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, class>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _Allocator& __a)
: __r_(__default_init_tag(), __a)
{
@@ -2114,13 +2220,14 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _
template <class _CharT, class _Traits, class _Allocator>
template <class _InputIterator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__is_exactly_cpp17_input_iterator<_InputIterator>::value
>
basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _InputIterator __last)
{
- __zero();
+ __default_init();
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
@@ -2140,12 +2247,15 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _Input
template <class _CharT, class _Traits, class _Allocator>
template <class _ForwardIterator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__is_cpp17_forward_iterator<_ForwardIterator>::value
>
basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _ForwardIterator __last)
{
+ if (__libcpp_is_constant_evaluated())
+ __zero();
size_type __sz = static_cast<size_type>(_VSTD::distance(__first, __last));
if (__sz > max_size())
__throw_length_error();
@@ -2159,6 +2269,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _For
{
auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__sz) + 1);
__p = __allocation.ptr;
+ __begin_lifetime(__p, __allocation.count);
__set_long_pointer(__p);
__set_long_cap(__allocation.count);
__set_long_size(__sz);
@@ -2184,7 +2295,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _For
template <class _CharT, class _Traits, class _Allocator>
template<class _InputIterator, class>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last)
: __r_(__default_init_tag(), __default_init_tag())
{
@@ -2194,7 +2305,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first,
template <class _CharT, class _Traits, class _Allocator>
template<class _InputIterator, class>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last,
const allocator_type& __a)
: __r_(__default_init_tag(), __a)
@@ -2206,7 +2317,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first,
#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string(
initializer_list<_CharT> __il)
: __r_(__default_init_tag(), __default_init_tag())
@@ -2216,8 +2327,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(
}
template <class _CharT, class _Traits, class _Allocator>
-inline
-
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::basic_string(
initializer_list<_CharT> __il, const _Allocator& __a)
: __r_(__default_init_tag(), __a)
@@ -2229,6 +2339,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(
#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::~basic_string()
{
#if _LIBCPP_DEBUG_LEVEL == 2
@@ -2240,6 +2351,7 @@ basic_string<_CharT, _Traits, _Allocator>::~basic_string()
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
@@ -2254,6 +2366,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
__ms - 1;
auto __allocation = std::__allocate_at_least(__alloc(), __cap + 1);
pointer __p = __allocation.ptr;
+ __begin_lifetime(__p, __allocation.count);
__invalidate_all_iterators();
if (__n_copy != 0)
traits_type::copy(_VSTD::__to_address(__p),
@@ -2264,7 +2377,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
if (__sec_cp_sz != 0)
traits_type::copy(_VSTD::__to_address(__p) + __n_copy + __n_add,
_VSTD::__to_address(__old_p) + __n_copy + __n_del, __sec_cp_sz);
- if (__old_cap+1 != __min_cap)
+ if (__old_cap+1 != __min_cap || __libcpp_is_constant_evaluated())
__alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
__set_long_pointer(__p);
__set_long_cap(__allocation.count);
@@ -2275,6 +2388,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
template <class _CharT, class _Traits, class _Allocator>
void
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
size_type __n_copy, size_type __n_del, size_type __n_add)
{
@@ -2287,6 +2401,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t
__ms - 1;
auto __allocation = std::__allocate_at_least(__alloc(), __cap + 1);
pointer __p = __allocation.ptr;
+ __begin_lifetime(__p, __allocation.count);
__invalidate_all_iterators();
if (__n_copy != 0)
traits_type::copy(_VSTD::__to_address(__p),
@@ -2296,8 +2411,8 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t
traits_type::copy(_VSTD::__to_address(__p) + __n_copy + __n_add,
_VSTD::__to_address(__old_p) + __n_copy + __n_del,
__sec_cp_sz);
- if (__old_cap+1 != __min_cap)
- __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
+ if (__libcpp_is_constant_evaluated() || __old_cap + 1 != __min_cap)
+ __alloc_traits::deallocate(__alloc(), __old_p, __old_cap + 1);
__set_long_pointer(__p);
__set_long_cap(__allocation.count);
}
@@ -2306,6 +2421,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t
template <class _CharT, class _Traits, class _Allocator>
template <bool __is_short>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::__assign_no_alias(
const value_type* __s, size_type __n) {
@@ -2313,7 +2429,7 @@ basic_string<_CharT, _Traits, _Allocator>::__assign_no_alias(
if (__n < __cap) {
pointer __p = __is_short ? __get_short_pointer() : __get_long_pointer();
__is_short ? __set_short_size(__n) : __set_long_size(__n);
- traits_type::copy(_VSTD::__to_address(__p), __s, __n);
+ traits_type::copy(std::__to_address(__p), __s, __n);
traits_type::assign(__p[__n], value_type());
__invalidate_iterators_past(__n);
} else {
@@ -2324,6 +2440,7 @@ basic_string<_CharT, _Traits, _Allocator>::__assign_no_alias(
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::__assign_external(
const value_type* __s, size_type __n) {
@@ -2340,6 +2457,7 @@ basic_string<_CharT, _Traits, _Allocator>::__assign_external(
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n)
{
@@ -2350,6 +2468,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_ty
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c)
{
@@ -2365,6 +2484,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c)
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c)
{
@@ -2386,6 +2506,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c)
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)
{
@@ -2407,7 +2528,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)
#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, false_type)
_NOEXCEPT_(__alloc_traits::is_always_equal::value)
@@ -2419,7 +2540,7 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, fa
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type)
#if _LIBCPP_STD_VER > 14
@@ -2440,12 +2561,16 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr
}
__move_assign_alloc(__str);
__r_.first() = __str.__r_.first();
- __str.__set_short_size(0);
- traits_type::assign(__str.__get_short_pointer()[0], value_type());
+ if (__libcpp_is_constant_evaluated()) {
+ __str.__default_init();
+ } else {
+ __str.__set_short_size(0);
+ traits_type::assign(__str.__get_short_pointer()[0], value_type());
+ }
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::operator=(basic_string&& __str)
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
@@ -2459,6 +2584,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(basic_string&& __str)
template <class _CharT, class _Traits, class _Allocator>
template<class _InputIterator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__is_exactly_cpp17_input_iterator<_InputIterator>::value,
@@ -2473,6 +2599,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(_InputIterator __first, _Input
template <class _CharT, class _Traits, class _Allocator>
template<class _ForwardIterator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__is_cpp17_forward_iterator<_ForwardIterator>::value,
@@ -2508,6 +2635,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(_ForwardIterator __first, _For
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, size_type __pos, size_type __n)
{
@@ -2519,6 +2647,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, siz
template <class _CharT, class _Traits, class _Allocator>
template <class _Tp>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value
@@ -2536,12 +2665,14 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const _Tp & __t, size_type __p
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::__assign_external(const value_type* __s) {
return __assign_external(__s, traits_type::length(__s));
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s)
{
@@ -2555,6 +2686,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s)
// append
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __n)
{
@@ -2578,6 +2710,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_ty
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c)
{
@@ -2597,7 +2730,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c)
}
template <class _CharT, class _Traits, class _Allocator>
-inline void
+_LIBCPP_CONSTEXPR_AFTER_CXX17 inline void
basic_string<_CharT, _Traits, _Allocator>::__append_default_init(size_type __n)
{
if (__n)
@@ -2614,6 +2747,7 @@ basic_string<_CharT, _Traits, _Allocator>::__append_default_init(size_type __n)
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c)
{
@@ -2635,7 +2769,7 @@ basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c)
__grow_by(__cap, 1, __sz, __sz, 0);
__is_short = false; // the string is always long after __grow_by
}
- pointer __p;
+ pointer __p = __get_pointer();
if (__is_short)
{
__p = __get_short_pointer() + __sz;
@@ -2652,6 +2786,7 @@ basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c)
template <class _CharT, class _Traits, class _Allocator>
template<class _ForwardIterator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__is_cpp17_forward_iterator<_ForwardIterator>::value,
@@ -2686,7 +2821,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str)
{
@@ -2694,6 +2829,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str)
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, size_type __pos, size_type __n)
{
@@ -2705,6 +2841,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, siz
template <class _CharT, class _Traits, class _Allocator>
template <class _Tp>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value,
@@ -2720,6 +2857,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const _Tp & __t, size_type __p
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s)
{
@@ -2730,6 +2868,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s)
// insert
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s, size_type __n)
{
@@ -2738,6 +2877,13 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_t
if (__pos > __sz)
__throw_out_of_range();
size_type __cap = capacity();
+ if (__libcpp_is_constant_evaluated()) {
+ if (__cap - __sz >= __n)
+ __grow_by_and_replace(__cap, 0, __sz, __pos, 0, __n, __s);
+ else
+ __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __pos, 0, __n, __s);
+ return *this;
+ }
if (__cap - __sz >= __n)
{
if (__n)
@@ -2762,6 +2908,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_t
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n, value_type __c)
{
@@ -2794,6 +2941,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n
template <class _CharT, class _Traits, class _Allocator>
template<class _InputIterator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__is_exactly_cpp17_input_iterator<_InputIterator>::value,
@@ -2810,6 +2958,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _InputIt
template <class _CharT, class _Traits, class _Allocator>
template<class _ForwardIterator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__is_cpp17_forward_iterator<_ForwardIterator>::value,
@@ -2837,7 +2986,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_string& __str)
{
@@ -2845,6 +2994,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_string& __str,
size_type __pos2, size_type __n)
@@ -2857,6 +3007,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_
template <class _CharT, class _Traits, class _Allocator>
template <class _Tp>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value,
@@ -2873,6 +3024,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const _Tp& _
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s)
{
@@ -2881,6 +3033,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_t
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::iterator
basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_type __c)
{
@@ -2911,7 +3064,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_ty
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::iterator
basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, size_type __n, value_type __c)
{
@@ -2926,6 +3079,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, size_typ
// replace
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2)
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
@@ -2938,6 +3092,10 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
size_type __cap = capacity();
if (__cap - __sz + __n1 >= __n2)
{
+ if (__libcpp_is_constant_evaluated()) {
+ __grow_by_and_replace(__cap, 0, __sz, __pos, __n1, __n2, __s);
+ return *this;
+ }
value_type* __p = _VSTD::__to_address(__get_pointer());
if (__n1 != __n2)
{
@@ -2975,6 +3133,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, size_type __n2, value_type __c)
{
@@ -3005,6 +3164,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
template <class _CharT, class _Traits, class _Allocator>
template<class _InputIterator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__is_cpp17_input_iterator<_InputIterator>::value,
@@ -3018,7 +3178,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_it
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type __n1, const basic_string& __str)
{
@@ -3026,6 +3186,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type _
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type __n1, const basic_string& __str,
size_type __pos2, size_type __n2)
@@ -3038,6 +3199,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type _
template <class _CharT, class _Traits, class _Allocator>
template <class _Tp>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value,
@@ -3054,6 +3216,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type _
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s)
{
@@ -3062,7 +3225,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const basic_string& __str)
{
@@ -3071,7 +3234,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_it
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n)
{
@@ -3079,7 +3242,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_it
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const value_type* __s)
{
@@ -3087,7 +3250,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_it
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c)
{
@@ -3099,6 +3262,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_it
// 'externally instantiated' erase() implementation, called when __n != npos.
// Does not check __pos against size()
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move(
size_type __pos, size_type __n)
@@ -3116,6 +3280,7 @@ basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move(
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos,
size_type __n) {
@@ -3130,7 +3295,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos,
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::iterator
basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos)
{
@@ -3146,7 +3311,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos)
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::iterator
basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_iterator __last)
{
@@ -3162,7 +3327,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_i
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::pop_back()
{
@@ -3171,7 +3336,7 @@ basic_string<_CharT, _Traits, _Allocator>::pop_back()
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::clear() _NOEXCEPT
{
@@ -3189,7 +3354,7 @@ basic_string<_CharT, _Traits, _Allocator>::clear() _NOEXCEPT
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::__erase_to_end(size_type __pos)
{
@@ -3197,6 +3362,7 @@ basic_string<_CharT, _Traits, _Allocator>::__erase_to_end(size_type __pos)
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::resize(size_type __n, value_type __c)
{
@@ -3208,7 +3374,7 @@ basic_string<_CharT, _Traits, _Allocator>::resize(size_type __n, value_type __c)
}
template <class _CharT, class _Traits, class _Allocator>
-inline void
+_LIBCPP_CONSTEXPR_AFTER_CXX17 inline void
basic_string<_CharT, _Traits, _Allocator>::__resize_default_init(size_type __n)
{
size_type __sz = size();
@@ -3219,7 +3385,7 @@ basic_string<_CharT, _Traits, _Allocator>::__resize_default_init(size_type __n)
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::max_size() const _NOEXCEPT
{
@@ -3233,6 +3399,7 @@ basic_string<_CharT, _Traits, _Allocator>::max_size() const _NOEXCEPT
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacity)
{
@@ -3253,7 +3420,7 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacit
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::shrink_to_fit() _NOEXCEPT
{
@@ -3264,7 +3431,7 @@ basic_string<_CharT, _Traits, _Allocator>::shrink_to_fit() _NOEXCEPT
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target_capacity)
{
@@ -3273,7 +3440,7 @@ basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target
pointer __new_data, __p;
bool __was_long, __now_long;
- if (__target_capacity == __min_cap - 1)
+ if (__fits_in_sso(__target_capacity))
{
__was_long = true;
__now_long = false;
@@ -3307,6 +3474,7 @@ basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target
return;
#endif // _LIBCPP_NO_EXCEPTIONS
}
+ __begin_lifetime(__new_data, __target_capacity + 1);
__now_long = true;
__was_long = __is_long();
__p = __get_pointer();
@@ -3327,7 +3495,7 @@ basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::const_reference
basic_string<_CharT, _Traits, _Allocator>::operator[](size_type __pos) const _NOEXCEPT
{
@@ -3336,7 +3504,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator[](size_type __pos) const _NO
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::reference
basic_string<_CharT, _Traits, _Allocator>::operator[](size_type __pos) _NOEXCEPT
{
@@ -3345,6 +3513,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator[](size_type __pos) _NOEXCEPT
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::const_reference
basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const
{
@@ -3354,6 +3523,7 @@ basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::reference
basic_string<_CharT, _Traits, _Allocator>::at(size_type __n)
{
@@ -3363,7 +3533,7 @@ basic_string<_CharT, _Traits, _Allocator>::at(size_type __n)
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::reference
basic_string<_CharT, _Traits, _Allocator>::front() _NOEXCEPT
{
@@ -3372,7 +3542,7 @@ basic_string<_CharT, _Traits, _Allocator>::front() _NOEXCEPT
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::const_reference
basic_string<_CharT, _Traits, _Allocator>::front() const _NOEXCEPT
{
@@ -3381,7 +3551,7 @@ basic_string<_CharT, _Traits, _Allocator>::front() const _NOEXCEPT
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::reference
basic_string<_CharT, _Traits, _Allocator>::back() _NOEXCEPT
{
@@ -3390,7 +3560,7 @@ basic_string<_CharT, _Traits, _Allocator>::back() _NOEXCEPT
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::const_reference
basic_string<_CharT, _Traits, _Allocator>::back() const _NOEXCEPT
{
@@ -3399,6 +3569,7 @@ basic_string<_CharT, _Traits, _Allocator>::back() const _NOEXCEPT
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::copy(value_type* __s, size_type __n, size_type __pos) const
{
@@ -3411,7 +3582,7 @@ basic_string<_CharT, _Traits, _Allocator>::copy(value_type* __s, size_type __n,
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>
basic_string<_CharT, _Traits, _Allocator>::substr(size_type __pos, size_type __n) const
{
@@ -3419,7 +3590,7 @@ basic_string<_CharT, _Traits, _Allocator>::substr(size_type __pos, size_type __n
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
#if _LIBCPP_STD_VER >= 14
@@ -3458,6 +3629,7 @@ struct _LIBCPP_HIDDEN __traits_eq
};
template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
size_type __pos,
@@ -3469,7 +3641,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
}
template<class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str,
size_type __pos) const _NOEXCEPT
@@ -3480,6 +3652,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str,
template<class _CharT, class _Traits, class _Allocator>
template <class _Tp>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -3494,7 +3667,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(const _Tp &__t,
}
template<class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
size_type __pos) const _NOEXCEPT
@@ -3505,6 +3678,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
}
template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find(value_type __c,
size_type __pos) const _NOEXCEPT
@@ -3516,6 +3690,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(value_type __c,
// rfind
template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
size_type __pos,
@@ -3527,7 +3702,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
}
template<class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str,
size_type __pos) const _NOEXCEPT
@@ -3538,6 +3713,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str,
template<class _CharT, class _Traits, class _Allocator>
template <class _Tp>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -3552,7 +3728,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const _Tp& __t,
}
template<class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
size_type __pos) const _NOEXCEPT
@@ -3563,6 +3739,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
}
template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c,
size_type __pos) const _NOEXCEPT
@@ -3574,6 +3751,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c,
// find_first_of
template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
size_type __pos,
@@ -3585,7 +3763,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
}
template<class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __str,
size_type __pos) const _NOEXCEPT
@@ -3596,6 +3774,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __s
template<class _CharT, class _Traits, class _Allocator>
template <class _Tp>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -3610,7 +3789,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const _Tp& __t,
}
template<class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
size_type __pos) const _NOEXCEPT
@@ -3621,7 +3800,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
}
template<class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_first_of(value_type __c,
size_type __pos) const _NOEXCEPT
@@ -3632,6 +3811,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(value_type __c,
// find_last_of
template<class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
size_type __pos,
@@ -3643,7 +3823,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
}
template<class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __str,
size_type __pos) const _NOEXCEPT
@@ -3654,6 +3834,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __st
template<class _CharT, class _Traits, class _Allocator>
template <class _Tp>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -3668,7 +3849,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const _Tp& __t,
}
template<class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
size_type __pos) const _NOEXCEPT
@@ -3679,7 +3860,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
}
template<class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_last_of(value_type __c,
size_type __pos) const _NOEXCEPT
@@ -3690,6 +3871,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(value_type __c,
// find_first_not_of
template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s,
size_type __pos,
@@ -3701,7 +3883,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* _
}
template<class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const basic_string& __str,
size_type __pos) const _NOEXCEPT
@@ -3712,6 +3894,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const basic_string&
template<class _CharT, class _Traits, class _Allocator>
template <class _Tp>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -3726,7 +3909,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const _Tp& __t,
}
template<class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s,
size_type __pos) const _NOEXCEPT
@@ -3737,7 +3920,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* _
}
template<class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,
size_type __pos) const _NOEXCEPT
@@ -3749,6 +3932,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,
// find_last_not_of
template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s,
size_type __pos,
@@ -3760,7 +3944,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __
}
template<class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const basic_string& __str,
size_type __pos) const _NOEXCEPT
@@ -3771,6 +3955,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const basic_string&
template<class _CharT, class _Traits, class _Allocator>
template <class _Tp>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -3785,7 +3970,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const _Tp& __t,
}
template<class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s,
size_type __pos) const _NOEXCEPT
@@ -3796,7 +3981,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __
}
template<class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c,
size_type __pos) const _NOEXCEPT
@@ -3809,6 +3994,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c,
template <class _CharT, class _Traits, class _Allocator>
template <class _Tp>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -3831,7 +4017,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(const _Tp& __t) const _NOEXCE
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
int
basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const _NOEXCEPT
{
@@ -3839,6 +4025,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) co
}
template <class _CharT, class _Traits, class _Allocator>
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
int
basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
size_type __n1,
@@ -3863,6 +4050,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
template <class _CharT, class _Traits, class _Allocator>
template <class _Tp>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
@@ -3877,7 +4065,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
}
template <class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
int
basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
size_type __n1,
@@ -3888,6 +4076,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
template <class _CharT, class _Traits, class _Allocator>
template <class _Tp>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
__enable_if_t
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value
@@ -3905,6 +4094,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
int
basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
size_type __n1,
@@ -3916,6 +4106,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
int
basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const _NOEXCEPT
{
@@ -3924,6 +4115,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const
}
template <class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
int
basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
size_type __n1,
@@ -3936,7 +4128,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
// __invariants
template<class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
bool
basic_string<_CharT, _Traits, _Allocator>::__invariants() const
{
@@ -3954,7 +4146,7 @@ basic_string<_CharT, _Traits, _Allocator>::__invariants() const
// __clear_and_shrink
template<class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT
{
@@ -3971,7 +4163,7 @@ basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT
// operator==
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool
operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
@@ -3983,7 +4175,7 @@ operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
}
template<class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool
operator==(const basic_string<char, char_traits<char>, _Allocator>& __lhs,
const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT
@@ -4002,7 +4194,7 @@ operator==(const basic_string<char, char_traits<char>, _Allocator>& __lhs,
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool
operator==(const _CharT* __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
@@ -4015,7 +4207,7 @@ operator==(const _CharT* __lhs,
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool
operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
const _CharT* __rhs) _NOEXCEPT
@@ -4028,7 +4220,7 @@ operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
@@ -4037,7 +4229,7 @@ operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const _CharT* __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
@@ -4046,7 +4238,7 @@ operator!=(const _CharT* __lhs,
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
const _CharT* __rhs) _NOEXCEPT
@@ -4057,7 +4249,7 @@ operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
// operator<
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool
operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
@@ -4066,7 +4258,7 @@ operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool
operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
const _CharT* __rhs) _NOEXCEPT
@@ -4075,7 +4267,7 @@ operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool
operator< (const _CharT* __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
@@ -4086,7 +4278,7 @@ operator< (const _CharT* __lhs,
// operator>
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool
operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
@@ -4095,7 +4287,7 @@ operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool
operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
const _CharT* __rhs) _NOEXCEPT
@@ -4104,7 +4296,7 @@ operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool
operator> (const _CharT* __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
@@ -4115,7 +4307,7 @@ operator> (const _CharT* __lhs,
// operator<=
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
@@ -4124,7 +4316,7 @@ operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
const _CharT* __rhs) _NOEXCEPT
@@ -4133,7 +4325,7 @@ operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const _CharT* __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
@@ -4144,7 +4336,7 @@ operator<=(const _CharT* __lhs,
// operator>=
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
@@ -4153,7 +4345,7 @@ operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
const _CharT* __rhs) _NOEXCEPT
@@ -4162,7 +4354,7 @@ operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const _CharT* __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
@@ -4173,6 +4365,7 @@ operator>=(const _CharT* __lhs,
// operator +
template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>
operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs)
@@ -4191,6 +4384,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
}
template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>
operator+(const _CharT* __lhs , const basic_string<_CharT,_Traits,_Allocator>& __rhs)
{
@@ -4208,6 +4402,7 @@ operator+(const _CharT* __lhs , const basic_string<_CharT,_Traits,_Allocator>& _
}
template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>
operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs)
{
@@ -4224,7 +4419,7 @@ operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs)
}
template<class _CharT, class _Traits, class _Allocator>
-inline
+inline _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>
operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs)
{
@@ -4242,6 +4437,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT*
}
template<class _CharT, class _Traits, class _Allocator>
+_LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>
operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs)
{
@@ -4260,7 +4456,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs)
#ifndef _LIBCPP_CXX03_LANG
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>
operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs)
{
@@ -4268,7 +4464,7 @@ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const basic_string<
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>
operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs)
{
@@ -4276,7 +4472,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>
operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs)
{
@@ -4284,7 +4480,7 @@ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, basic_string<_CharT
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>
operator+(const _CharT* __lhs , basic_string<_CharT,_Traits,_Allocator>&& __rhs)
{
@@ -4292,7 +4488,7 @@ operator+(const _CharT* __lhs , basic_string<_CharT,_Traits,_Allocator>&& __rhs)
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>
operator+(_CharT __lhs, basic_string<_CharT,_Traits,_Allocator>&& __rhs)
{
@@ -4301,7 +4497,7 @@ operator+(_CharT __lhs, basic_string<_CharT,_Traits,_Allocator>&& __rhs)
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>
operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const _CharT* __rhs)
{
@@ -4309,7 +4505,7 @@ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const _CharT* __rhs
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<_CharT, _Traits, _Allocator>
operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs)
{
@@ -4322,7 +4518,7 @@ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs)
// swap
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void
swap(basic_string<_CharT, _Traits, _Allocator>& __lhs,
basic_string<_CharT, _Traits, _Allocator>& __rhs)
@@ -4487,14 +4683,14 @@ inline namespace literals
{
inline namespace string_literals
{
- inline _LIBCPP_INLINE_VISIBILITY
+ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<char> operator "" s( const char *__str, size_t __len )
{
return basic_string<char> (__str, __len);
}
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- inline _LIBCPP_INLINE_VISIBILITY
+ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<wchar_t> operator "" s( const wchar_t *__str, size_t __len )
{
return basic_string<wchar_t> (__str, __len);
@@ -4502,20 +4698,20 @@ inline namespace literals
#endif
#ifndef _LIBCPP_HAS_NO_CHAR8_T
- inline _LIBCPP_INLINE_VISIBILITY
+ inline _LIBCPP_INLINE_VISIBILITY constexpr
basic_string<char8_t> operator "" s(const char8_t *__str, size_t __len) _NOEXCEPT
{
return basic_string<char8_t> (__str, __len);
}
#endif
- inline _LIBCPP_INLINE_VISIBILITY
+ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<char16_t> operator "" s( const char16_t *__str, size_t __len )
{
return basic_string<char16_t> (__str, __len);
}
- inline _LIBCPP_INLINE_VISIBILITY
+ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
basic_string<char32_t> operator "" s( const char32_t *__str, size_t __len )
{
return basic_string<char32_t> (__str, __len);
diff --git a/libcxx/include/version b/libcxx/include/version
index 7f0e47eb3ae42..d65ccdc46a7a8 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -63,7 +63,7 @@ __cpp_lib_constexpr_functional 201907L <functional>
__cpp_lib_constexpr_iterator 201811L <iterator>
__cpp_lib_constexpr_memory 201811L <memory>
__cpp_lib_constexpr_numeric 201911L <numeric>
-__cpp_lib_constexpr_string 201811L <string>
+__cpp_lib_constexpr_string 201907L <string>
__cpp_lib_constexpr_string_view 201811L <string_view>
__cpp_lib_constexpr_tuple 201811L <tuple>
__cpp_lib_constexpr_typeinfo 202106L <typeinfo>
@@ -316,7 +316,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_constexpr_iterator 201811L
# define __cpp_lib_constexpr_memory 201811L
# define __cpp_lib_constexpr_numeric 201911L
-# define __cpp_lib_constexpr_string 201811L
+# define __cpp_lib_constexpr_string 201907L
# define __cpp_lib_constexpr_string_view 201811L
# define __cpp_lib_constexpr_tuple 201811L
# define __cpp_lib_constexpr_utility 201811L
diff --git a/libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp
index 65dfead25cdf0..80e9c2d476f69 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp
@@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED:
-
// <string>
// This test ensures that the correct max_size() is returned depending on the platform.
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/string.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/string.version.compile.pass.cpp
index b397888f10dbe..cae7970ef1e84 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/string.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/string.version.compile.pass.cpp
@@ -18,7 +18,7 @@
/* Constant Value
__cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
__cpp_lib_char8_t 201811L [C++20]
- __cpp_lib_constexpr_string 201811L [C++20]
+ __cpp_lib_constexpr_string 201907L [C++20]
__cpp_lib_erase_if 202002L [C++20]
__cpp_lib_nonmember_container_access 201411L [C++17]
__cpp_lib_ranges_to_container 202202L [C++2b]
@@ -211,8 +211,8 @@
# ifndef __cpp_lib_constexpr_string
# error "__cpp_lib_constexpr_string should be defined in c++20"
# endif
-# if __cpp_lib_constexpr_string != 201811L
-# error "__cpp_lib_constexpr_string should have the value 201811L in c++20"
+# if __cpp_lib_constexpr_string != 201907L
+# error "__cpp_lib_constexpr_string should have the value 201907L in c++20"
# endif
# ifndef __cpp_lib_erase_if
@@ -287,8 +287,8 @@
# ifndef __cpp_lib_constexpr_string
# error "__cpp_lib_constexpr_string should be defined in c++2b"
# endif
-# if __cpp_lib_constexpr_string != 201811L
-# error "__cpp_lib_constexpr_string should have the value 201811L in c++2b"
+# if __cpp_lib_constexpr_string != 201907L
+# error "__cpp_lib_constexpr_string should have the value 201907L in c++2b"
# endif
# ifndef __cpp_lib_erase_if
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
index 89eb1469f99e7..c287aabc5af54 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
@@ -59,7 +59,7 @@
__cpp_lib_constexpr_iterator 201811L [C++20]
__cpp_lib_constexpr_memory 201811L [C++20]
__cpp_lib_constexpr_numeric 201911L [C++20]
- __cpp_lib_constexpr_string 201811L [C++20]
+ __cpp_lib_constexpr_string 201907L [C++20]
__cpp_lib_constexpr_string_view 201811L [C++20]
__cpp_lib_constexpr_tuple 201811L [C++20]
__cpp_lib_constexpr_typeinfo 202106L [C++2b]
@@ -2725,8 +2725,8 @@
# ifndef __cpp_lib_constexpr_string
# error "__cpp_lib_constexpr_string should be defined in c++20"
# endif
-# if __cpp_lib_constexpr_string != 201811L
-# error "__cpp_lib_constexpr_string should have the value 201811L in c++20"
+# if __cpp_lib_constexpr_string != 201907L
+# error "__cpp_lib_constexpr_string should have the value 201907L in c++20"
# endif
# ifndef __cpp_lib_constexpr_string_view
@@ -3963,8 +3963,8 @@
# ifndef __cpp_lib_constexpr_string
# error "__cpp_lib_constexpr_string should be defined in c++2b"
# endif
-# if __cpp_lib_constexpr_string != 201811L
-# error "__cpp_lib_constexpr_string should have the value 201811L in c++2b"
+# if __cpp_lib_constexpr_string != 201907L
+# error "__cpp_lib_constexpr_string should have the value 201907L in c++2b"
# endif
# ifndef __cpp_lib_constexpr_string_view
diff --git a/libcxx/test/std/strings/basic.string/string.access/at.pass.cpp b/libcxx/test/std/strings/basic.string/string.access/at.pass.cpp
index 07cefd233a90c..796f1a7051f9b 100644
--- a/libcxx/test/std/strings/basic.string/string.access/at.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.access/at.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// const_reference at(size_type pos) const;
-// reference at(size_type pos);
+// const_reference at(size_type pos) const; // constexpr since C++20
+// reference at(size_type pos); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -30,7 +32,7 @@ test(S s, typename S::size_type pos)
assert(cs.at(pos) == cs[pos]);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -54,7 +56,7 @@ test(S s, typename S::size_type pos)
#endif
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), 0);
@@ -81,7 +83,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.access/back.pass.cpp b/libcxx/test/std/strings/basic.string/string.access/back.pass.cpp
index 13d31a3ceaf1e..388643420f623 100644
--- a/libcxx/test/std/strings/basic.string/string.access/back.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.access/back.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// const charT& back() const;
-// charT& back();
+// const charT& back() const; // constexpr since C++20
+// charT& back(); // constexpr since C++20
#include <string>
#include <cassert>
@@ -32,7 +34,7 @@ test(S s)
assert(s.back() == typename S::value_type('z'));
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S("1"));
@@ -53,7 +55,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.access/front.pass.cpp b/libcxx/test/std/strings/basic.string/string.access/front.pass.cpp
index 8a02695c749c1..03c1bb192b2cd 100644
--- a/libcxx/test/std/strings/basic.string/string.access/front.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.access/front.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// const charT& front() const;
-// charT& front();
+// const charT& front() const; // constexpr since C++20
+// charT& front(); // constexpr since C++20
#include <string>
#include <cassert>
@@ -32,7 +34,7 @@ test(S s)
assert(s.front() == typename S::value_type('z'));
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S("1"));
@@ -53,7 +55,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.access/index.pass.cpp b/libcxx/test/std/strings/basic.string/string.access/index.pass.cpp
index bd46ff9bc6014..752d486a2cf1f 100644
--- a/libcxx/test/std/strings/basic.string/string.access/index.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.access/index.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// const_reference operator[](size_type pos) const;
-// reference operator[](size_type pos);
+// const_reference operator[](size_type pos) const; // constexpr since C++20
+// reference operator[](size_type pos); // constexpr since C++20
#include <string>
#include <cassert>
@@ -17,7 +19,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
S s("0123456789");
@@ -62,7 +64,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/capacity.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/capacity.pass.cpp
index f3850a4387041..a32b8aa20cfd1 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/capacity.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/capacity.pass.cpp
@@ -8,7 +8,7 @@
// <string>
-// size_type capacity() const;
+// size_type capacity() const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -18,11 +18,9 @@
#include "test_macros.h"
-test_allocator_statistics alloc_stats;
-
template <class S>
TEST_CONSTEXPR_CXX20 void
-test(S s)
+test(S s, test_allocator_statistics& alloc_stats)
{
alloc_stats.throw_after = 0;
#ifndef TEST_HAS_NO_EXCEPTIONS
@@ -42,17 +40,18 @@ test(S s)
alloc_stats.throw_after = INT_MAX;
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
+ test_allocator_statistics alloc_stats;
typedef std::basic_string<char, std::char_traits<char>, test_allocator<char> > S;
S s((test_allocator<char>(&alloc_stats)));
- test(s);
+ test(s, alloc_stats);
s.assign(10, 'a');
s.erase(5);
- test(s);
+ test(s, alloc_stats);
s.assign(100, 'a');
s.erase(50);
- test(s);
+ test(s, alloc_stats);
}
#if TEST_STD_VER >= 11
{
@@ -69,7 +68,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/clear.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/clear.pass.cpp
index 51cf6cc8bcf61..0e31c9409e502 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/clear.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/clear.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// void clear();
+// void clear(); // constexpr since C++20
#include <string>
#include <cassert>
@@ -24,7 +26,7 @@ test(S s)
assert(s.size() == 0);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
S s;
@@ -61,7 +63,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/empty.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/empty.pass.cpp
index fd02b9a820917..7a31d1714a840 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/empty.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/empty.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// bool empty() const noexcept;
+// bool empty() const noexcept; // constexpr since C++20
#include <string>
#include <cassert>
@@ -24,7 +26,7 @@ test(const S& s)
assert(s.empty() == (s.size() == 0));
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S());
@@ -47,7 +49,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/empty.verify.cpp b/libcxx/test/std/strings/basic.string/string.capacity/empty.verify.cpp
index f4dd157424eb4..26a4daf6047bd 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/empty.verify.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/empty.verify.cpp
@@ -10,7 +10,7 @@
// class deque
-// bool empty() const noexcept;
+// bool empty() const noexcept; // constexpr since C++20
// UNSUPPORTED: c++03, c++11, c++14, c++17
@@ -18,7 +18,7 @@
#include "test_macros.h"
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
std::string c;
c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
@@ -29,7 +29,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/length.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/length.pass.cpp
index 67bba0f13820a..c64ed7306e06c 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/length.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/length.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type length() const;
+// size_type length() const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -17,13 +19,13 @@
#include "min_allocator.h"
template <class S>
-void
+TEST_CONSTEXPR_CXX20 void
test(const S& s)
{
assert(s.length() == s.size());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S());
@@ -46,7 +48,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/max_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/max_size.pass.cpp
index 8e9825d0bd0a1..a2971ad72ef92 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/max_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/max_size.pass.cpp
@@ -9,7 +9,7 @@
// UNSUPPORTED: no-exceptions
// <string>
-// size_type max_size() const;
+// size_type max_size() const; // constexpr since C++20
// NOTE: asan and msan will fail for one of two reasons
// 1. If allocator_may_return_null=0 then they will fail because the allocation
@@ -25,7 +25,7 @@
#include "min_allocator.h"
template <class S>
-void
+TEST_CONSTEXPR_CXX20 void
test1(const S& s)
{
S s2(s);
@@ -36,7 +36,7 @@ test1(const S& s)
}
template <class S>
-void
+TEST_CONSTEXPR_CXX20 void
test2(const S& s)
{
S s2(s);
@@ -47,7 +47,7 @@ test2(const S& s)
}
template <class S>
-void
+TEST_CONSTEXPR_CXX20 void
test(const S& s)
{
assert(s.max_size() >= s.size());
@@ -55,7 +55,7 @@ test(const S& s)
test2(s);
}
-bool test() {
+void test() {
{
typedef std::string S;
test(S());
@@ -70,15 +70,25 @@ bool test() {
test(S("12345678901234567890123456789012345678901234567890"));
}
#endif
+}
+
+#if TEST_STD_VER > 17
+constexpr bool test_constexpr() {
+ std::string str;
+
+ size_t size = str.max_size();
+ assert(size > 0);
return true;
}
+#endif
int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ test_constexpr();
+ static_assert(test_constexpr());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp
index a2c699456d858..fed6daa6fa7da 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp
@@ -16,7 +16,7 @@
// <string>
-// size_type max_size() const;
+// size_type max_size() const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -59,9 +59,6 @@ bool test() {
int main(int, char**)
{
test();
-#if TEST_STD_VER > 17
- // static_assert(test());
-#endif
return 0;
}
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
index 332d71b24cb96..a5ef265788697 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
@@ -20,7 +20,7 @@
#include "min_allocator.h"
template <class S>
-TEST_CONSTEXPR_CXX20 void
+void
test(typename S::size_type min_cap, typename S::size_type erased_index)
{
S s(min_cap, 'a');
@@ -63,9 +63,6 @@ bool test() {
int main(int, char**)
{
test();
-#if TEST_STD_VER > 17
- // static_assert(test());
-#endif
return 0;
}
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp
index 7cdf6c0c06ea8..91a744970711d 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// void reserve(size_type res_arg);
+// void reserve(size_type res_arg); // constexpr since C++20
// This test relies on https://llvm.org/PR45368 being fixed, which isn't in
// older Apple dylibs
@@ -62,7 +64,7 @@ test(typename S::size_type min_cap, typename S::size_type erased_index, typename
#endif
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
{
@@ -105,7 +107,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/resize_and_overwrite.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/resize_and_overwrite.pass.cpp
index 61312fa5ec49a..b22a9036e70f2 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/resize_and_overwrite.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/resize_and_overwrite.pass.cpp
@@ -90,18 +90,14 @@ int main(int, char**) {
test<char16_t>();
test<char32_t>();
-#if defined(__cpp_lib_constexpr_string) && __cpp_lib_constexpr_string >= 201907L
static_assert(test<char>());
static_assert(test<char8_t>());
static_assert(test<char16_t>());
static_assert(test<char32_t>());
-#endif
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<wchar_t>();
-#if defined(__cpp_lib_constexpr_string) && __cpp_lib_constexpr_string >= 201907L
static_assert(test<wchar_t>());
-#endif
#endif
return 0;
}
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp
index fa03112ca8b62..8eb158048a23e 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// void resize(size_type n);
+// void resize(size_type n); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -43,7 +45,7 @@ test(S s, typename S::size_type n, S expected)
#endif
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), 0, S());
@@ -92,7 +94,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
index 6cd3f1c1f6f7f..0b10ca9ac9475 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// void resize(size_type n, charT c);
+// void resize(size_type n, charT c); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -43,7 +45,7 @@ test(S s, typename S::size_type n, typename S::value_type c, S expected)
#endif
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), 0, 'a', S());
@@ -92,7 +94,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp
index fa1e3dbdcfeb4..08df98f3eeb44 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// void shrink_to_fit();
+// void shrink_to_fit(); // constexpr since C++20
#include <string>
#include <cassert>
@@ -29,7 +31,7 @@ test(S s)
assert(s.capacity() >= s.size());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
S s;
@@ -66,7 +68,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/size.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/size.pass.cpp
index e67221ecd821c..037fdeec02780 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type size() const;
+// size_type size() const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -23,7 +25,7 @@ test(const S& s, typename S::size_type c)
assert(s.size() == c);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), 0);
@@ -46,7 +48,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp
index b3153a6427d16..6ef6dc511391f 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class _Tp>
// basic_string(const _Tp& __t, size_type __pos, size_type __n,
-// const allocator_type& __a = allocator_type());
+// const allocator_type& __a = allocator_type()); // constexpr since C++20
//
// Mostly we're testing string_view here
@@ -91,7 +93,7 @@ test(SV sv, std::size_t pos, std::size_t n, const typename S::allocator_type& a)
#endif
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef test_allocator<char> A;
typedef std::basic_string_view<char, std::char_traits<char> > SV;
@@ -189,7 +191,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/alloc.pass.cpp
index 140fb22967840..add77f8e57325 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/alloc.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/alloc.pass.cpp
@@ -8,7 +8,7 @@
// <string>
-// explicit basic_string(const Allocator& a = Allocator());
+// explicit basic_string(const Allocator& a = Allocator()); // constexpr since C++20
#include <string>
#include <cassert>
@@ -85,7 +85,7 @@ test2()
#endif
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
test<std::basic_string<char, std::char_traits<char>, test_allocator<char> > >();
#if TEST_STD_VER >= 11
test2<std::basic_string<char, std::char_traits<char>, min_allocator<char> > >();
@@ -99,7 +99,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp
index 2702385bd51a3..6c676b7ce15b5 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp
@@ -11,14 +11,14 @@
// <string>
// basic_string<charT,traits,Allocator>&
-// operator=(basic_string<charT,traits,Allocator>&& str);
+// operator=(basic_string<charT,traits,Allocator>&& str); // constexpr since C++20
#include <string>
#include <cassert>
#include "test_macros.h"
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
// Test that assignment from {} and {ptr, len} are allowed and are not
// ambiguous.
{
@@ -39,7 +39,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/char_assignment.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/char_assignment.pass.cpp
index 8b3b42189e264..7884d6155a59b 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/char_assignment.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/char_assignment.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// basic_string<charT,traits,Allocator>& operator=(charT c);
+// basic_string<charT,traits,Allocator>& operator=(charT c); // constexpr since C++20
#include <string>
#include <cassert>
@@ -28,7 +30,7 @@ test(S s1, typename S::value_type s2)
assert(s1.capacity() >= s1.size());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), 'a');
@@ -53,7 +55,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/copy.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/copy.pass.cpp
index a7a79c9beb221..a62a0ab9f1cbd 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/copy.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/copy.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// basic_string(const basic_string<charT,traits,Allocator>& str);
+// basic_string(const basic_string<charT,traits,Allocator>& str); // constexpr since C++20
#include <string>
#include <cassert>
@@ -28,7 +30,7 @@ test(S s1)
assert(s2.get_allocator() == s1.get_allocator());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef test_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
@@ -53,7 +55,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp
index fc12c4d27d0ae..ad33d78edc440 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// basic_string(const basic_string& str, const Allocator& alloc);
+// basic_string(const basic_string& str, const Allocator& alloc); // constexpr since C++20
#include <string>
#include <cassert>
@@ -88,7 +90,7 @@ test(S s1, const typename S::allocator_type& a)
assert(s2.get_allocator() == a);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef test_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
@@ -135,7 +137,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp
index 0b82c8e85154d..4dbc679833d37 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// operator=(const basic_string<charT,traits,Allocator>& str);
+// operator=(const basic_string<charT,traits,Allocator>& str); // constexpr since C++20
#include <string>
#include <cassert>
@@ -27,7 +29,7 @@ test(S s1, const S& s2)
assert(s1.capacity() >= s1.size());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), S());
@@ -83,7 +85,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/default.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/default.pass.cpp
index 812bc71480100..beb16c099f025 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/default.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/default.pass.cpp
@@ -8,7 +8,7 @@
// <string>
-// basic_string() noexcept(is_nothrow_default_constructible<allocator_type>::value);
+// basic_string() noexcept(is_nothrow_default_constructible<allocator_type>::value); // constexpr since C++20
#include <cassert>
#include <string>
@@ -25,7 +25,7 @@ LIBCPP_STATIC_ASSERT(!std::is_nothrow_default_constructible<
std::basic_string<char, std::char_traits<char>, limited_allocator<char, 10>>>::value, "");
#endif
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
std::string str;
assert(str.empty());
@@ -36,7 +36,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/dtor.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/dtor.pass.cpp
index 1b498811adf4b..0464bc3890a6b 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/dtor.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/dtor.pass.cpp
@@ -10,7 +10,7 @@
// <string>
-// ~basic_string() // implied noexcept;
+// ~basic_string() // implied noexcept; // constexpr since C++20
#include <string>
#include <cassert>
@@ -40,7 +40,7 @@ static_assert(std::is_nothrow_destructible<
LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<
std::basic_string<char, std::char_traits<char>, throwing_alloc<char>>>::value, "");
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
test_allocator_statistics alloc_stats;
{
std::basic_string<char, std::char_traits<char>, test_allocator<char>> str2((test_allocator<char>(&alloc_stats)));
@@ -56,7 +56,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/implicit_deduction_guides.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/implicit_deduction_guides.pass.cpp
index f2ff9146d8c3a..f9cdeac8b203e 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/implicit_deduction_guides.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/implicit_deduction_guides.pass.cpp
@@ -45,7 +45,7 @@ using BStr = std::basic_string<T, std::char_traits<T>, Alloc>;
// (13) basic_string(initializer_list<CharT>, A const& = A())
// (14) basic_string(BSV, A const& = A())
// (15) basic_string(const T&, size_type, size_type, A const& = A())
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
using TestSizeT = test_allocator<char>::size_type;
{ // Testing (1)
@@ -372,7 +372,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/initializer_list.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/initializer_list.pass.cpp
index 9d8359110ba2c..ef8503013c7b8 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/initializer_list.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/initializer_list.pass.cpp
@@ -8,9 +8,11 @@
// UNSUPPORTED: c++03
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// basic_string(initializer_list<charT> il, const Allocator& a = Allocator());
+// basic_string(initializer_list<charT> il, const Allocator& a = Allocator()); // constexpr since C++20
#include <string>
#include <cassert>
@@ -19,7 +21,7 @@
#include "test_allocator.h"
#include "min_allocator.h"
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
std::string s = {'a', 'b', 'c'};
assert(s == "abc");
@@ -52,7 +54,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp
index 406ba9a2e5f62..500a09bb3e984 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp
@@ -10,7 +10,7 @@
// <string>
-// basic_string& operator=(initializer_list<charT> il);
+// basic_string& operator=(initializer_list<charT> il); // constexpr since C++20
#include <string>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
std::string s;
s = {'a', 'b', 'c'};
@@ -38,7 +38,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
index e08d6dd547820..e67b16c05a65f 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class InputIterator>
// basic_string(InputIterator begin, InputIterator end,
-// const Allocator& a = Allocator());
+// const Allocator& a = Allocator()); // constexpr since C++20
#include <string>
@@ -62,7 +64,7 @@ test(It first, It last, const A& a)
assert(s2.capacity() >= s2.size());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef test_allocator<char> A;
const char* s = "12345678901234567890123456789012345678901234567890";
@@ -138,7 +140,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
index d483af689abf7..15c3c04ef3862 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
@@ -9,12 +9,14 @@
// <string>
// UNSUPPORTED: c++03, c++11, c++14
+// XFAIL: LIBCXX-AIX-FIXME
+
// template<class InputIterator,
// class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
// basic_string(InputIterator, InputIterator, Allocator = Allocator())
// -> basic_string<typename iterator_traits<InputIterator>::value_type,
// char_traits<typename iterator_traits<InputIterator>::value_type>,
-// Allocator>;
+// Allocator>; // constexpr since C++20
//
// The deduction guide shall not participate in overload resolution if InputIterator
// is a type that does not qualify as an input iterator, or if Allocator is a type
@@ -49,7 +51,7 @@ static_assert(!CanDeduce<NotAnIterator, std::allocator<char>>::value);
static_assert(!CanDeduce<NotAnInputIterator, std::allocator<char16_t>>::value);
static_assert(!CanDeduce<wchar_t const*, NotAnAllocator<wchar_t>>::value);
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
const char* s = "12345678901234";
std::basic_string s1(s, s+10); // Can't use {} here
@@ -108,7 +110,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/move.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/move.pass.cpp
index 84ff7c48f6b94..391794bac64fc 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/move.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/move.pass.cpp
@@ -8,9 +8,11 @@
// UNSUPPORTED: c++03
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// basic_string(basic_string<charT,traits,Allocator>&& str);
+// basic_string(basic_string<charT,traits,Allocator>&& str); // constexpr since C++20
#include <string>
#include <cassert>
@@ -32,7 +34,7 @@ test(S s0)
assert(s2.get_allocator() == s1.get_allocator());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef test_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
@@ -55,7 +57,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/move_alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/move_alloc.pass.cpp
index e0a15f77f6bf6..194574f815662 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/move_alloc.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/move_alloc.pass.cpp
@@ -8,9 +8,11 @@
// UNSUPPORTED: c++03
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// basic_string(basic_string&& str, const Allocator& alloc);
+// basic_string(basic_string&& str, const Allocator& alloc); // constexpr since C++20
#include <string>
#include <cassert>
@@ -32,7 +34,7 @@ test(S s0, const typename S::allocator_type& a)
assert(s2.get_allocator() == a);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
test_allocator_statistics alloc_stats;
{
typedef test_allocator<char> A;
@@ -80,7 +82,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp
index 7e8b92700a00a..c2b97ecb3ec00 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp
@@ -13,12 +13,12 @@
// basic_string& operator=(basic_string&& c)
// noexcept(
// allocator_traits<allocator_type>::propagate_on_container_move_assignment::value ||
-// allocator_traits<allocator_type>::is_always_equal::value); // C++17
+// allocator_traits<allocator_type>::is_always_equal::value); // C++17, constexpr since C++20
//
// before C++17, we use the conforming extension
// noexcept(
// allocator_type::propagate_on_container_move_assignment::value &&
-// is_nothrow_move_assignable<allocator_type>::value);
+// is_nothrow_move_assignable<allocator_type>::value); // constexpr since C++20
#include <string>
#include <cassert>
@@ -62,7 +62,7 @@ struct some_alloc3
typedef std::false_type is_always_equal;
};
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
@@ -100,7 +100,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/move_assignment.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/move_assignment.pass.cpp
index 21bd451ff396d..79a23646b7848 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/move_assignment.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/move_assignment.pass.cpp
@@ -8,10 +8,12 @@
// UNSUPPORTED: c++03
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// operator=(basic_string<charT,traits,Allocator>&& str);
+// operator=(basic_string<charT,traits,Allocator>&& str); // constexpr since C++20
#include <string>
#include <cassert>
@@ -32,7 +34,7 @@ test(S s1, S s2)
assert(s1.capacity() >= s1.size());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), S());
@@ -77,7 +79,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/move_noexcept.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/move_noexcept.pass.cpp
index 5d3343258c220..5d88f7f18dfc8 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/move_noexcept.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/move_noexcept.pass.cpp
@@ -11,7 +11,7 @@
// <string>
// basic_string(basic_string&&)
-// noexcept(is_nothrow_move_constructible<allocator_type>::value);
+// noexcept(is_nothrow_move_constructible<allocator_type>::value); // constexpr since C++20
// This tests a conforming extension
diff --git a/libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp
index 287ef833f94b4..da8ae5b3a6c5d 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp
@@ -8,7 +8,9 @@
// <string>
-// basic_string(const charT* s, const Allocator& a = Allocator());
+// XFAIL: LIBCXX-AIX-FIXME
+
+// basic_string(const charT* s, const Allocator& a = Allocator()); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -51,7 +53,7 @@ test(const charT* s, const A& a)
assert(s2.capacity() >= s2.size());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef test_allocator<char> A;
@@ -92,7 +94,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp
index 972ba0b079b57..44aa431dfc184 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// operator=(const charT* s);
+// operator=(const charT* s); // constexpr since C++20
#include <string>
#include <cassert>
@@ -29,7 +31,7 @@ test(S s1, const typename S::value_type* s2)
assert(s1.capacity() >= s1.size());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), "");
@@ -76,7 +78,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp
index c254d42654847..003cddc7b0a28 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// basic_string(const charT* s, size_type n, const Allocator& a = Allocator());
+// basic_string(const charT* s, size_type n, const Allocator& a = Allocator()); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -48,7 +50,7 @@ test(const charT* s, unsigned n, const A& a)
assert(s2.capacity() >= s2.size());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef test_allocator<char> A;
@@ -97,7 +99,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
index 80d4756de64d0..86194462b250f 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// basic_string(size_type n, charT c, const Allocator& a = Allocator());
+// basic_string(size_type n, charT c, const Allocator& a = Allocator()); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -50,7 +52,7 @@ test(unsigned n, charT c, const A& a)
}
template <class Tp>
-void
+TEST_CONSTEXPR_CXX20 void
test(Tp n, Tp c)
{
typedef char charT;
@@ -80,7 +82,7 @@ test(Tp n, Tp c, const A& a)
assert(s2.capacity() >= s2.size());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef test_allocator<char> A;
@@ -127,7 +129,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/string_view.pass.cpp
index 4621ba7acae1d..6be12e0e186da 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/string_view.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// explicit basic_string(basic_string_view<CharT, traits> sv, const Allocator& a = Allocator());
+// explicit basic_string(basic_string_view<CharT, traits> sv, const Allocator& a = Allocator()); // constexpr since C++20
#include <algorithm>
#include <cassert>
@@ -75,7 +77,7 @@ test(std::basic_string_view<charT> sv, const A& a)
}
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef test_allocator<char> A;
typedef std::basic_string_view<char, std::char_traits<char> > SV;
@@ -118,7 +120,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/string_view_assignment.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/string_view_assignment.pass.cpp
index cb7cc73a3b79e..833fc0b63eddc 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/string_view_assignment.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/string_view_assignment.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// basic_string<charT,traits,Allocator>& operator=(basic_string_view<charT, traits> sv);
+// basic_string<charT,traits,Allocator>& operator=(basic_string_view<charT, traits> sv); // constexpr since C++20
#include <string>
#include <cassert>
@@ -28,7 +30,7 @@ test(S s1, SV sv)
assert(s1.capacity() >= s1.size());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -77,7 +79,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/string_view_deduction.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/string_view_deduction.pass.cpp
index cdb045d9f1371..b559120497b60 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/string_view_deduction.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/string_view_deduction.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// UNSUPPORTED: c++03, c++11, c++14
@@ -43,7 +45,7 @@ struct NotAnAllocator { };
static_assert( CanDeduce<std::string_view, std::allocator<char>>::value);
static_assert(!CanDeduce<std::string_view, NotAnAllocator>::value);
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
std::string_view sv = "12345678901234";
std::basic_string s1(sv);
@@ -77,7 +79,7 @@ bool test() {
assert(s1.compare(0, s1.size(), sv.data(), s1.size()) == 0);
}
#endif
-#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+#ifndef TEST_HAS_NO_CHAR8_T
{
std::u8string_view sv = u8"12345678901234";
std::basic_string s1{sv, min_allocator<char8_t>{}};
@@ -117,7 +119,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/string_view_size_size_deduction.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/string_view_size_size_deduction.pass.cpp
index f0dfec2d34485..1551594850f53 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/string_view_size_size_deduction.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/string_view_size_size_deduction.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// UNSUPPORTED: c++03, c++11, c++14
@@ -47,7 +49,7 @@ struct NotAnAllocator { };
static_assert( CanDeduce<std::string_view, std::size_t, std::allocator<char>>::value);
static_assert(!CanDeduce<std::string_view, std::size_t, NotAnAllocator>::value);
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
std::string_view sv = "12345678901234";
std::basic_string s1{sv, 0, 4};
@@ -81,7 +83,7 @@ bool test() {
assert(s1.compare(0, s1.size(), sv.data(), s1.size()) == 0);
}
#endif
-#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+#ifndef TEST_HAS_NO_CHAR8_T
{
std::u8string_view sv = u8"12345678901234";
std::basic_string s1{sv, 0, 4, min_allocator<char8_t>{}};
@@ -121,7 +123,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.cons/substr.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/substr.pass.cpp
index 24787938b0ed7..e8e54e3569103 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/substr.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/substr.pass.cpp
@@ -6,15 +6,17 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string(const basic_string<charT,traits,Allocator>& str,
// size_type pos, size_type n,
-// const Allocator& a = Allocator());
+// const Allocator& a = Allocator()); // constexpr since C++20
//
// basic_string(const basic_string<charT,traits,Allocator>& str,
// size_type pos,
-// const Allocator& a = Allocator());
+// const Allocator& a = Allocator()); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -138,7 +140,7 @@ void test_lwg2583()
#endif
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef test_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
@@ -225,7 +227,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
test_lwg2583();
diff --git a/libcxx/test/std/strings/basic.string/string.contains/contains.char.pass.cpp b/libcxx/test/std/strings/basic.string/string.contains/contains.char.pass.cpp
index f190d602523c7..3b410f725f43b 100644
--- a/libcxx/test/std/strings/basic.string/string.contains/contains.char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.contains/contains.char.pass.cpp
@@ -9,14 +9,14 @@
// <string>
-// constexpr bool contains(charT x) const noexcept;
+// constexpr bool contains(charT x) const noexcept;
#include <string>
#include <cassert>
#include "test_macros.h"
-bool test()
+constexpr bool test()
{
using S = std::string;
@@ -38,9 +38,7 @@ bool test()
int main(int, char**)
{
test();
-#if TEST_STD_VER > 17
- // static_assert(test());
-#endif
+ static_assert(test());
return 0;
}
diff --git a/libcxx/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp b/libcxx/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp
index 0ff1043dad4c8..978e8143475b0 100644
--- a/libcxx/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp
@@ -9,14 +9,14 @@
// <string>
-// constexpr bool contains(const CharT *x) const;
+// constexpr bool contains(const CharT *x) const;
#include <string>
#include <cassert>
#include "test_macros.h"
-bool test()
+constexpr bool test()
{
using S = std::string;
@@ -68,9 +68,7 @@ bool test()
int main(int, char**)
{
test();
-#if TEST_STD_VER > 17
- // static_assert(test());
-#endif
+ static_assert(test());
return 0;
}
diff --git a/libcxx/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp
index bafee71ef39c9..77301c7941b76 100644
--- a/libcxx/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp
@@ -9,14 +9,14 @@
// <string>
-// constexpr bool contains(basic_string_view x) const noexcept;
+// constexpr bool contains(basic_string_view x) const noexcept;
#include <string>
#include <cassert>
#include "test_macros.h"
-bool test()
+constexpr bool test()
{
using S = std::string;
using SV = std::string_view;
@@ -89,9 +89,7 @@ bool test()
int main(int, char**)
{
test();
-#if TEST_STD_VER > 17
- // static_assert(test());
-#endif
+ static_assert(test());
return 0;
}
diff --git a/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.char.pass.cpp b/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.char.pass.cpp
index 1b418e313c2cc..da5f5ac96318f 100644
--- a/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.char.pass.cpp
@@ -9,14 +9,14 @@
// <string>
-// bool ends_with(charT x) const noexcept;
+// constexpr bool ends_with(charT x) const noexcept;
#include <string>
#include <cassert>
#include "test_macros.h"
-bool test() {
+constexpr bool test() {
{
typedef std::string S;
S s1 {};
@@ -36,9 +36,7 @@ bool test() {
int main(int, char**)
{
test();
-#if TEST_STD_VER > 17
- // static_assert(test());
-#endif
+ static_assert(test());
return 0;
}
diff --git a/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.ptr.pass.cpp b/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.ptr.pass.cpp
index c2654929b5d5d..86796c447c1a8 100644
--- a/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.ptr.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.ptr.pass.cpp
@@ -9,14 +9,14 @@
// <string>
-// bool ends_with(const CharT *x) const;
+// constexpr bool ends_with(const CharT *x) const;
#include <string>
#include <cassert>
#include "test_macros.h"
-bool test() {
+constexpr bool test() {
{
typedef std::string S;
const char *s = "abcde";
@@ -64,9 +64,7 @@ bool test() {
int main(int, char**) {
test();
-#if TEST_STD_VER > 17
- // static_assert(test());
-#endif
+ static_assert(test());
return 0;
}
diff --git a/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.string_view.pass.cpp
index 9f764499ab37b..a4600d74a78f8 100644
--- a/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.string_view.pass.cpp
@@ -9,14 +9,14 @@
// <string>
-// bool ends_with(basic_string_view x) const noexcept;
+// constexpr bool ends_with(basic_string_view x) const noexcept;
#include <string>
#include <cassert>
#include "test_macros.h"
-bool test() {
+constexpr bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -73,9 +73,7 @@ bool test() {
int main(int, char**) {
test();
-#if TEST_STD_VER > 17
- // static_assert(test());
-#endif
+ static_assert(test());
return 0;
}
diff --git a/libcxx/test/std/strings/basic.string/string.iterators/begin.pass.cpp b/libcxx/test/std/strings/basic.string/string.iterators/begin.pass.cpp
index c6394fcb268e3..258883f18e525 100644
--- a/libcxx/test/std/strings/basic.string/string.iterators/begin.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.iterators/begin.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// iterator begin();
-// const_iterator begin() const;
+// iterator begin(); // constexpr since C++20
+// const_iterator begin() const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -31,7 +33,7 @@ test(S s)
assert(b == cb);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S());
@@ -52,7 +54,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.iterators/cbegin.pass.cpp b/libcxx/test/std/strings/basic.string/string.iterators/cbegin.pass.cpp
index af9dfaa654c45..fe520d4d256c9 100644
--- a/libcxx/test/std/strings/basic.string/string.iterators/cbegin.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.iterators/cbegin.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// const_iterator cbegin() const;
+// const_iterator cbegin() const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -28,7 +30,7 @@ test(const S& s)
assert(cb == s.begin());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S());
@@ -49,7 +51,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.iterators/cend.pass.cpp b/libcxx/test/std/strings/basic.string/string.iterators/cend.pass.cpp
index 2607c099255c0..d545790fdaf87 100644
--- a/libcxx/test/std/strings/basic.string/string.iterators/cend.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.iterators/cend.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// const_iterator cend() const;
+// const_iterator cend() const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -24,7 +26,7 @@ test(const S& s)
assert(ce == s.end());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S());
@@ -45,7 +47,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
}
diff --git a/libcxx/test/std/strings/basic.string/string.iterators/crbegin.pass.cpp b/libcxx/test/std/strings/basic.string/string.iterators/crbegin.pass.cpp
index b5a2ec7a0d28f..c06d28509d1a8 100644
--- a/libcxx/test/std/strings/basic.string/string.iterators/crbegin.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.iterators/crbegin.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// const_reverse_iterator crbegin() const;
+// const_reverse_iterator crbegin() const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -28,7 +30,7 @@ test(const S& s)
assert(cb == s.rbegin());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S());
@@ -49,7 +51,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.iterators/crend.pass.cpp b/libcxx/test/std/strings/basic.string/string.iterators/crend.pass.cpp
index 090c22eabbc77..0dff0157da048 100644
--- a/libcxx/test/std/strings/basic.string/string.iterators/crend.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.iterators/crend.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// const_reverse_iterator crend() const;
+// const_reverse_iterator crend() const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -24,7 +26,7 @@ test(const S& s)
assert(ce == s.rend());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S());
@@ -45,7 +47,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.iterators/end.pass.cpp b/libcxx/test/std/strings/basic.string/string.iterators/end.pass.cpp
index 21d6b1bc2b45f..8f877cc66742d 100644
--- a/libcxx/test/std/strings/basic.string/string.iterators/end.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.iterators/end.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// iterator end();
-// const_iterator end() const;
+// iterator end(); // constexpr since C++20
+// const_iterator end() const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -34,7 +36,7 @@ test(S s)
assert(static_cast<std::size_t>(ce - cs.begin()) == cs.size());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S());
@@ -55,7 +57,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.iterators/iterators.pass.cpp b/libcxx/test/std/strings/basic.string/string.iterators/iterators.pass.cpp
index 0ab3a549dd5af..161c9add90278 100644
--- a/libcxx/test/std/strings/basic.string/string.iterators/iterators.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.iterators/iterators.pass.cpp
@@ -10,12 +10,12 @@
// <string>
-// iterator begin();
-// iterator end();
-// const_iterator begin() const;
-// const_iterator end() const;
-// const_iterator cbegin() const;
-// const_iterator cend() const;
+// iterator begin(); // constexpr since C++20
+// iterator end(); // constexpr since C++20
+// const_iterator begin() const; // constexpr since C++20
+// const_iterator end() const; // constexpr since C++20
+// const_iterator cbegin() const; // constexpr since C++20
+// const_iterator cend() const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -65,7 +65,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
test<std::wstring>();
#endif
-#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+#ifndef TEST_HAS_NO_CHAR8_T
test<std::u8string>();
#endif
@@ -78,7 +78,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
int main(int, char**)
{
test();
-#if defined(__cpp_lib_constexpr_string) && __cpp_lib_constexpr_string >= 201907L
+#if TEST_STD_VER > 17
static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.iterators/rbegin.pass.cpp b/libcxx/test/std/strings/basic.string/string.iterators/rbegin.pass.cpp
index 13ec36b0a62ae..20ce55e5f82b8 100644
--- a/libcxx/test/std/strings/basic.string/string.iterators/rbegin.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.iterators/rbegin.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// reverse_iterator rbegin();
-// const_reverse_iterator rbegin() const;
+// reverse_iterator rbegin(); // constexpr since C++20
+// const_reverse_iterator rbegin() const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -31,7 +33,7 @@ test(S s)
assert(b == cb);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S());
@@ -52,7 +54,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.iterators/rend.pass.cpp b/libcxx/test/std/strings/basic.string/string.iterators/rend.pass.cpp
index 02cc5e5d15afb..219c9f6c61efa 100644
--- a/libcxx/test/std/strings/basic.string/string.iterators/rend.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.iterators/rend.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// reverse_iterator rend();
-// const_reverse_iterator rend() const;
+// reverse_iterator rend(); // constexpr since C++20
+// const_reverse_iterator rend() const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -34,7 +36,7 @@ test(S s)
assert(static_cast<std::size_t>(ce - cs.rbegin()) == cs.size());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S());
@@ -55,7 +57,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/robust_against_adl.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/robust_against_adl.pass.cpp
index 9c85badcffcd0..90b275b6c3c65 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/robust_against_adl.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/robust_against_adl.pass.cpp
@@ -23,7 +23,7 @@ struct Charlike {
TEST_CONSTEXPR operator char() const { return ch_; }
};
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
std::string s;
Charlike<Holder<Incomplete> > a[] = {'m', 'a', 'h', 'i'};
s.append(a, a+4);
@@ -39,7 +39,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp
index 29467c956a24b..d79cea3a0d43a 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template <class T>
-// basic_string& append(const T& t, size_type pos, size_type n=npos); // C++17
+// basic_string& append(const T& t, size_type pos, size_type n=npos); // C++17, constexpr since C++20
#include <string>
#include <string>
@@ -71,7 +73,7 @@ test_npos(S s, SV sv, typename S::size_type pos, S expected)
#endif
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -203,7 +205,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp
index f72c3ce075f9c..066d8cf8b6f66 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// UNSUPPORTED: c++03
// <string>
-// basic_string& append(initializer_list<charT> il);
+// basic_string& append(initializer_list<charT> il); // constexpr since C++20
#include <string>
#include <cassert>
@@ -18,7 +20,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
std::string s("123");
s.append({'a', 'b', 'c'});
@@ -38,7 +40,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
index 07d84a7d5c2c5..637eb6b1273c2 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class InputIterator>
-// basic_string& append(InputIterator first, InputIterator last);
+// basic_string& append(InputIterator first, InputIterator last); // constexpr since C++20
#include <string>
#include <cassert>
@@ -52,7 +54,7 @@ test_exceptions(S s, It first, It last)
}
#endif
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
@@ -259,7 +261,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp
index 5881ef1e04c47..cb8897a540e5d 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// basic_string<charT,traits,Allocator>& append(const charT* s);
+// basic_string<charT,traits,Allocator>& append(const charT* s); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -26,7 +28,7 @@ test(S s, const typename S::value_type* str, S expected)
assert(s == expected);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), "", S());
@@ -83,7 +85,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp
index 69a5b93c4b150..56a6fc97a8833 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// append(const charT* s, size_type n);
+// append(const charT* s, size_type n); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -27,7 +29,7 @@ test(S s, const typename S::value_type* str, typename S::size_type n, S expected
assert(s == expected);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), "", 0, S());
@@ -92,7 +94,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
index 55506b37d25da..04b04486ca4e3 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// void push_back(charT c)
+// void push_back(charT c) // constexpr since C++20
#include <string>
#include <cassert>
@@ -31,7 +33,7 @@ test(S s, typename S::value_type c, S expected)
assert(s == expected);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), 'a', S(1, 'a'));
@@ -63,7 +65,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp
index 5b66e686dd07e..4efe8f8866eff 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// append(size_type n, charT c);
+// append(size_type n, charT c); // constexpr since C++20
#include <string>
#include <cassert>
@@ -26,7 +28,7 @@ test(S s, typename S::size_type n, typename S::value_type c, S expected)
assert(s == expected);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), 0, 'a', S());
@@ -67,7 +69,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp
index 8c4bbf1d2b099..77fe15153de76 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// append(const basic_string<charT,traits>& str);
+// append(const basic_string<charT,traits>& str); // constexpr since C++20
#include <string>
#include <cassert>
@@ -26,7 +28,7 @@ test(S s, S str, S expected)
assert(s == expected);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), S(), S());
@@ -92,7 +94,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
index 6c046fc8d859c..6a000f9e43cb1 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// append(const basic_string<charT,traits>& str, size_type pos, size_type n = npos);
+// append(const basic_string<charT,traits>& str, size_type pos, size_type n = npos); // constexpr since C++20
// the "= npos" was added for C++14
#include <string>
@@ -71,7 +73,7 @@ test_npos(S s, S str, typename S::size_type pos, S expected)
#endif
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), S(), 0, 0, S());
@@ -140,7 +142,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_view.pass.cpp
index 7c0f6c2f027b0..68e1114942e34 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_view.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// append(basic_string_view<charT,traits> sv);
+// append(basic_string_view<charT,traits> sv); // constexpr since C++20
#include <string>
#include <string_view>
@@ -27,7 +29,7 @@ test(S s, SV sv, S expected)
assert(s == expected);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -86,7 +88,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp
index 7b810f5200a89..27ba35bb8738f 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template <class T>
-// basic_string& assign(const T& t, size_type pos, size_type n=npos); // C++17
+// basic_string& assign(const T& t, size_type pos, size_type n=npos); // C++17, constexpr since C++20
#include <string>
#include <stdexcept>
@@ -70,7 +72,7 @@ test_npos(S s, SV sv, typename S::size_type pos, S expected)
#endif
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -198,7 +200,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/initializer_list.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/initializer_list.pass.cpp
index b9ee6a2692222..4585a82803bfd 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/initializer_list.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/initializer_list.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// UNSUPPORTED: c++03
// <string>
-// basic_string& assign(initializer_list<charT> il);
+// basic_string& assign(initializer_list<charT> il); // constexpr since C++20
#include <string>
#include <cassert>
@@ -18,7 +20,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
std::string s("123");
s.assign({'a', 'b', 'c'});
@@ -38,7 +40,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
index 2646aff77306d..440789088e1e5 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class InputIterator>
-// basic_string& assign(InputIterator first, InputIterator last);
+// basic_string& assign(InputIterator first, InputIterator last); // constexpr since C++20
#include <string>
#include <cassert>
@@ -52,7 +54,7 @@ test_exceptions(S s, It first, It last)
}
#endif
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
@@ -230,7 +232,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp
index 991c9d3129584..dd5c1dc2766bc 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// basic_string<charT,traits,Allocator>& assign(const charT* s);
+// basic_string<charT,traits,Allocator>& assign(const charT* s); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -26,7 +28,7 @@ test(S s, const typename S::value_type* str, S expected)
assert(s == expected);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), "", S());
@@ -81,7 +83,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp
index 5a708a9be215e..2e5f99501dfb5 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// assign(const charT* s, size_type n);
+// assign(const charT* s, size_type n); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -27,7 +29,7 @@ test(S s, const typename S::value_type* str, typename S::size_type n, S expected
assert(s == expected);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), "", 0, S());
@@ -92,7 +94,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/rv_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/rv_string.pass.cpp
index 37a1eff5fa37c..49dbd2c05059b 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/rv_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/rv_string.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// assign(basic_string<charT,traits>&& str);
+// assign(basic_string<charT,traits>&& str); // constexpr since C++20
#include <string>
#include <utility>
@@ -27,7 +29,7 @@ test(S s, S str, S expected)
assert(s == expected);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), S(), S());
@@ -84,7 +86,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp
index 6855bc41e86ac..a455f7d071daf 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// assign(size_type n, charT c);
+// assign(size_type n, charT c); // constexpr since C++20
#include <string>
#include <cassert>
@@ -26,7 +28,7 @@ test(S s, typename S::size_type n, typename S::value_type c, S expected)
assert(s == expected);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), 0, 'a', S());
@@ -67,7 +69,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp
index 8787aba6b1201..1d7f7bc5a07b7 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// assign(const basic_string<charT,traits>& str);
+// assign(const basic_string<charT,traits>& str); // constexpr since C++20
#include <string>
#include <cassert>
@@ -37,7 +39,7 @@ testAlloc(S s, S str, const typename S::allocator_type& a)
assert(s.get_allocator() == a);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), S(), S());
@@ -120,7 +122,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp
index f7a74108fb076..0c6015f47279e 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// assign(const basic_string<charT,traits>& str, size_type pos, size_type n=npos);
+// assign(const basic_string<charT,traits>& str, size_type pos, size_type n=npos); // constexpr since C++20
// the =npos was added for C++14
#include <string>
@@ -30,7 +32,7 @@ test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected)
assert(s == expected);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -56,7 +58,7 @@ test_npos(S s, S str, typename S::size_type pos, S expected)
assert(s == expected);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -71,7 +73,7 @@ test_npos(S s, S str, typename S::size_type pos, S expected)
#endif
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), S(), 0, 0, S());
@@ -140,7 +142,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_view.pass.cpp
index 2fc2d7ec26a5a..6d1b8b3c5de72 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_view.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// assign(basic_string_view<charT,traits> sv);
+// assign(basic_string_view<charT,traits> sv); // constexpr since C++20
#include <string>
#include <string_view>
@@ -38,7 +40,7 @@ testAlloc(S s, SV sv, const typename S::allocator_type& a)
assert(s.get_allocator() == a);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -108,7 +110,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
index 2ccdb19ebe757..f91e8fab9f3fe 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type copy(charT* s, size_type n, size_type pos = 0) const;
+// size_type copy(charT* s, size_type n, size_type pos = 0) const; // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -19,7 +21,7 @@
#include "min_allocator.h"
template <class S>
-void
+TEST_CONSTEXPR_CXX20 void
test(S str, typename S::value_type* s, typename S::size_type n,
typename S::size_type pos)
{
@@ -33,7 +35,7 @@ test(S str, typename S::value_type* s, typename S::size_type n,
assert(S::traits_type::eq(cs[pos+r], s[r]));
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -49,7 +51,7 @@ test(S str, typename S::value_type* s, typename S::size_type n,
#endif
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
char s[50];
@@ -184,7 +186,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
index d9c73a1588524..d189742705589 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// iterator erase(const_iterator p);
+// iterator erase(const_iterator p); // constexpr since C++20
#include <string>
#include <cassert>
@@ -28,7 +30,7 @@ test(S s, typename S::
diff erence_type pos, S expected)
assert(i - s.begin() == pos);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S("abcde"), 0, S("bcde"));
@@ -69,7 +71,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
index 8f4cc91f06d45..9caae3f600ad4 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// iterator erase(const_iterator first, const_iterator last);
+// iterator erase(const_iterator first, const_iterator last); // constexpr since C++20
#include <string>
#include <cassert>
@@ -29,7 +31,7 @@ test(S s, typename S::
diff erence_type pos, typename S::
diff erence_type n, S expe
assert(i - s.begin() == pos);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), 0, 0, S(""));
@@ -154,7 +156,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
index fe961a00af63b..5c8328bee0468 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// void pop_back();
+// void pop_back(); // constexpr since C++20
#include <string>
#include <cassert>
@@ -26,7 +28,7 @@ test(S s, S expected)
assert(s == expected);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S("abcde"), S("abcd"));
@@ -49,7 +51,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
index 6e3c84ef8c4a2..041ad9ecc0c1a 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// erase(size_type pos = 0, size_type n = npos);
+// erase(size_type pos = 0, size_type n = npos); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -32,7 +34,7 @@ test(S s, typename S::size_type pos, typename S::size_type n, S expected)
assert(s == expected);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -62,7 +64,7 @@ test(S s, typename S::size_type pos, S expected)
assert(s == expected);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -88,7 +90,7 @@ test(S s, S expected)
assert(s == expected);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), 0, 0, S(""));
@@ -305,7 +307,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp
index 98831abee6e46..bc0844865154c 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// iterator insert(const_iterator p, charT c);
+// iterator insert(const_iterator p, charT c); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -32,7 +34,7 @@ test(S& s, typename S::const_iterator p, typename S::value_type c, S expected)
assert(i == p);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
S s;
@@ -79,7 +81,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp
index 2b8d7d5c40ceb..051bf30e3ba76 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp
@@ -8,9 +8,11 @@
// UNSUPPORTED: c++03
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// iterator insert(const_iterator p, initializer_list<charT> il);
+// iterator insert(const_iterator p, initializer_list<charT> il); // constexpr since C++20
#include <string>
@@ -19,7 +21,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
std::string s("123456");
std::string::iterator i = s.insert(s.begin() + 3, {'a', 'b', 'c'});
@@ -41,7 +43,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
index a4e78382ce391..7a03868eaa01d 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class InputIterator>
-// iterator insert(const_iterator p, InputIterator first, InputIterator last);
+// iterator insert(const_iterator p, InputIterator first, InputIterator last); // constexpr since C++20
#include <string>
#include <cassert>
@@ -56,7 +58,7 @@ test_exceptions(S s, typename S::
diff erence_type pos, It first, It last)
}
#endif
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
@@ -150,7 +152,7 @@ bool test() {
}
#endif
#ifndef TEST_HAS_NO_EXCEPTIONS
- { // test iterator operations that throw
+ if (!TEST_IS_CONSTANT_EVALUATED) { // test iterator operations that throw
typedef std::string S;
typedef ThrowingIterator<char> TIter;
typedef cpp17_input_iterator<TIter> IIter;
@@ -193,7 +195,7 @@ bool test() {
assert(s == "ABCD");
}
- { // regression-test inserting into self in sneaky ways
+ if (!TEST_IS_CONSTANT_EVALUATED) { // regression-test inserting into self in sneaky ways
std::string s_short = "hello";
std::string s_long = "Lorem ipsum dolor sit amet, consectetur/";
std::string s_othertype = "hello";
@@ -238,7 +240,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp
index 7af0be6898f0f..3b1aea24ab6fa 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// iterator insert(const_iterator p, size_type n, charT c);
+// iterator insert(const_iterator p, size_type n, charT c); // constexpr since C++20
#include <string>
#include <cassert>
@@ -28,7 +30,7 @@ test(S s, typename S::
diff erence_type pos, typename S::size_type n,
assert(s == expected);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), 0, 0, '1', S(""));
@@ -173,7 +175,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp
index 6d4b036b7332a..b166ba8b79f6b 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template <class T>
-// basic_string& assign(size_type pos1, const T& t, size_type pos2, size_type n=npos); // C++17
+// basic_string& assign(size_type pos1, const T& t, size_type pos2, size_type n=npos); // C++17, constexpr since C++20
//
// Mostly we're testing string_view here
@@ -35,7 +37,7 @@ test(S s, typename S::size_type pos1, SV sv, typename S::size_type pos2,
assert(s == expected);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -65,7 +67,7 @@ test_npos(S s, typename S::size_type pos1, SV sv, typename S::size_type pos2, S
assert(s == expected);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -1792,7 +1794,7 @@ TEST_CONSTEXPR_CXX20 bool test30()
}
template <class S, class SV>
-bool test31() {
+TEST_CONSTEXPR_CXX20 bool test31() {
S s;
SV sv = "EFGH";
char arr[] = "IJKL";
@@ -1864,38 +1866,38 @@ void test() {
test31<S, SV>();
#if TEST_STD_VER > 17
- // static_assert(test0<S, SV>());
- // static_assert(test1<S, SV>());
- // static_assert(test2<S, SV>());
- // static_assert(test3<S, SV>());
- // static_assert(test4<S, SV>());
- // static_assert(test5<S, SV>());
- // static_assert(test6<S, SV>());
- // static_assert(test7<S, SV>());
- // static_assert(test8<S, SV>());
- // static_assert(test9<S, SV>());
- // static_assert(test10<S, SV>());
- // static_assert(test11<S, SV>());
- // static_assert(test12<S, SV>());
- // static_assert(test13<S, SV>());
- // static_assert(test14<S, SV>());
- // static_assert(test15<S, SV>());
- // static_assert(test16<S, SV>());
- // static_assert(test17<S, SV>());
- // static_assert(test18<S, SV>());
- // static_assert(test19<S, SV>());
- // static_assert(test20<S, SV>());
- // static_assert(test21<S, SV>());
- // static_assert(test22<S, SV>());
- // static_assert(test23<S, SV>());
- // static_assert(test24<S, SV>());
- // static_assert(test25<S, SV>());
- // static_assert(test26<S, SV>());
- // static_assert(test27<S, SV>());
- // static_assert(test28<S, SV>());
- // static_assert(test29<S, SV>());
- // static_assert(test30<S, SV>());
- // static_assert(test31<S, SV>());
+ static_assert(test0<S, SV>());
+ static_assert(test1<S, SV>());
+ static_assert(test2<S, SV>());
+ static_assert(test3<S, SV>());
+ static_assert(test4<S, SV>());
+ static_assert(test5<S, SV>());
+ static_assert(test6<S, SV>());
+ static_assert(test7<S, SV>());
+ static_assert(test8<S, SV>());
+ static_assert(test9<S, SV>());
+ static_assert(test10<S, SV>());
+ static_assert(test11<S, SV>());
+ static_assert(test12<S, SV>());
+ static_assert(test13<S, SV>());
+ static_assert(test14<S, SV>());
+ static_assert(test15<S, SV>());
+ static_assert(test16<S, SV>());
+ static_assert(test17<S, SV>());
+ static_assert(test18<S, SV>());
+ static_assert(test19<S, SV>());
+ static_assert(test20<S, SV>());
+ static_assert(test21<S, SV>());
+ static_assert(test22<S, SV>());
+ static_assert(test23<S, SV>());
+ static_assert(test24<S, SV>());
+ static_assert(test25<S, SV>());
+ static_assert(test26<S, SV>());
+ static_assert(test27<S, SV>());
+ static_assert(test28<S, SV>());
+ static_assert(test29<S, SV>());
+ static_assert(test30<S, SV>());
+ static_assert(test31<S, SV>());
#endif
}
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp
index d619f5e601cc0..d21ef83be3d04 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// insert(size_type pos, const charT* s);
+// insert(size_type pos, const charT* s); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -31,7 +33,7 @@ test(S s, typename S::size_type pos, const typename S::value_type* str, S expect
assert(s == expected);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -47,7 +49,7 @@ test(S s, typename S::size_type pos, const typename S::value_type* str, S expect
#endif
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), 0, "", S(""));
@@ -240,7 +242,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp
index 0a54a4309e4eb..7678889f5a3ad 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// insert(size_type pos, const charT* s, size_type n);
+// insert(size_type pos, const charT* s, size_type n); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -32,7 +34,7 @@ test(S s, typename S::size_type pos, const typename S::value_type* str,
assert(s == expected);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -48,333 +50,9 @@ test(S s, typename S::size_type pos, const typename S::value_type* str,
#endif
}
-bool test() {
- {
- typedef std::string S;
- test(S(""), 0, "", 0, S(""));
- test(S(""), 0, "12345", 0, S(""));
- test(S(""), 0, "12345", 1, S("1"));
- test(S(""), 0, "12345", 2, S("12"));
- test(S(""), 0, "12345", 4, S("1234"));
- test(S(""), 0, "12345", 5, S("12345"));
- test(S(""), 0, "1234567890", 0, S(""));
- test(S(""), 0, "1234567890", 1, S("1"));
- test(S(""), 0, "1234567890", 5, S("12345"));
- test(S(""), 0, "1234567890", 9, S("123456789"));
- test(S(""), 0, "1234567890", 10, S("1234567890"));
- test(S(""), 0, "12345678901234567890", 0, S(""));
- test(S(""), 0, "12345678901234567890", 1, S("1"));
- test(S(""), 0, "12345678901234567890", 10, S("1234567890"));
- test(S(""), 0, "12345678901234567890", 19, S("1234567890123456789"));
- test(S(""), 0, "12345678901234567890", 20, S("12345678901234567890"));
- test(S(""), 1, "", 0, S("can't happen"));
- test(S(""), 1, "12345", 0, S("can't happen"));
- test(S(""), 1, "12345", 1, S("can't happen"));
- test(S(""), 1, "12345", 2, S("can't happen"));
- test(S(""), 1, "12345", 4, S("can't happen"));
- test(S(""), 1, "12345", 5, S("can't happen"));
- test(S(""), 1, "1234567890", 0, S("can't happen"));
- test(S(""), 1, "1234567890", 1, S("can't happen"));
- test(S(""), 1, "1234567890", 5, S("can't happen"));
- test(S(""), 1, "1234567890", 9, S("can't happen"));
- test(S(""), 1, "1234567890", 10, S("can't happen"));
- test(S(""), 1, "12345678901234567890", 0, S("can't happen"));
- test(S(""), 1, "12345678901234567890", 1, S("can't happen"));
- test(S(""), 1, "12345678901234567890", 10, S("can't happen"));
- test(S(""), 1, "12345678901234567890", 19, S("can't happen"));
- test(S(""), 1, "12345678901234567890", 20, S("can't happen"));
- test(S("abcde"), 0, "", 0, S("abcde"));
- test(S("abcde"), 0, "12345", 0, S("abcde"));
- test(S("abcde"), 0, "12345", 1, S("1abcde"));
- test(S("abcde"), 0, "12345", 2, S("12abcde"));
- test(S("abcde"), 0, "12345", 4, S("1234abcde"));
- test(S("abcde"), 0, "12345", 5, S("12345abcde"));
- test(S("abcde"), 0, "1234567890", 0, S("abcde"));
- test(S("abcde"), 0, "1234567890", 1, S("1abcde"));
- test(S("abcde"), 0, "1234567890", 5, S("12345abcde"));
- test(S("abcde"), 0, "1234567890", 9, S("123456789abcde"));
- test(S("abcde"), 0, "1234567890", 10, S("1234567890abcde"));
- test(S("abcde"), 0, "12345678901234567890", 0, S("abcde"));
- test(S("abcde"), 0, "12345678901234567890", 1, S("1abcde"));
- test(S("abcde"), 0, "12345678901234567890", 10, S("1234567890abcde"));
- test(S("abcde"), 0, "12345678901234567890", 19, S("1234567890123456789abcde"));
- test(S("abcde"), 0, "12345678901234567890", 20, S("12345678901234567890abcde"));
- test(S("abcde"), 1, "", 0, S("abcde"));
- test(S("abcde"), 1, "12345", 0, S("abcde"));
- test(S("abcde"), 1, "12345", 1, S("a1bcde"));
- test(S("abcde"), 1, "12345", 2, S("a12bcde"));
- test(S("abcde"), 1, "12345", 4, S("a1234bcde"));
- test(S("abcde"), 1, "12345", 5, S("a12345bcde"));
- test(S("abcde"), 1, "1234567890", 0, S("abcde"));
- test(S("abcde"), 1, "1234567890", 1, S("a1bcde"));
- test(S("abcde"), 1, "1234567890", 5, S("a12345bcde"));
- test(S("abcde"), 1, "1234567890", 9, S("a123456789bcde"));
- test(S("abcde"), 1, "1234567890", 10, S("a1234567890bcde"));
- test(S("abcde"), 1, "12345678901234567890", 0, S("abcde"));
- test(S("abcde"), 1, "12345678901234567890", 1, S("a1bcde"));
- test(S("abcde"), 1, "12345678901234567890", 10, S("a1234567890bcde"));
- test(S("abcde"), 1, "12345678901234567890", 19, S("a1234567890123456789bcde"));
- test(S("abcde"), 1, "12345678901234567890", 20, S("a12345678901234567890bcde"));
- test(S("abcde"), 2, "", 0, S("abcde"));
- test(S("abcde"), 2, "12345", 0, S("abcde"));
- test(S("abcde"), 2, "12345", 1, S("ab1cde"));
- test(S("abcde"), 2, "12345", 2, S("ab12cde"));
- test(S("abcde"), 2, "12345", 4, S("ab1234cde"));
- test(S("abcde"), 2, "12345", 5, S("ab12345cde"));
- test(S("abcde"), 2, "1234567890", 0, S("abcde"));
- test(S("abcde"), 2, "1234567890", 1, S("ab1cde"));
- test(S("abcde"), 2, "1234567890", 5, S("ab12345cde"));
- test(S("abcde"), 2, "1234567890", 9, S("ab123456789cde"));
- test(S("abcde"), 2, "1234567890", 10, S("ab1234567890cde"));
- test(S("abcde"), 2, "12345678901234567890", 0, S("abcde"));
- test(S("abcde"), 2, "12345678901234567890", 1, S("ab1cde"));
- test(S("abcde"), 2, "12345678901234567890", 10, S("ab1234567890cde"));
- test(S("abcde"), 2, "12345678901234567890", 19, S("ab1234567890123456789cde"));
- test(S("abcde"), 2, "12345678901234567890", 20, S("ab12345678901234567890cde"));
- test(S("abcde"), 4, "", 0, S("abcde"));
- test(S("abcde"), 4, "12345", 0, S("abcde"));
- test(S("abcde"), 4, "12345", 1, S("abcd1e"));
- test(S("abcde"), 4, "12345", 2, S("abcd12e"));
- test(S("abcde"), 4, "12345", 4, S("abcd1234e"));
- test(S("abcde"), 4, "12345", 5, S("abcd12345e"));
- test(S("abcde"), 4, "1234567890", 0, S("abcde"));
- test(S("abcde"), 4, "1234567890", 1, S("abcd1e"));
- test(S("abcde"), 4, "1234567890", 5, S("abcd12345e"));
- test(S("abcde"), 4, "1234567890", 9, S("abcd123456789e"));
- test(S("abcde"), 4, "1234567890", 10, S("abcd1234567890e"));
- test(S("abcde"), 4, "12345678901234567890", 0, S("abcde"));
- test(S("abcde"), 4, "12345678901234567890", 1, S("abcd1e"));
- test(S("abcde"), 4, "12345678901234567890", 10, S("abcd1234567890e"));
- test(S("abcde"), 4, "12345678901234567890", 19, S("abcd1234567890123456789e"));
- test(S("abcde"), 4, "12345678901234567890", 20, S("abcd12345678901234567890e"));
- test(S("abcde"), 5, "", 0, S("abcde"));
- test(S("abcde"), 5, "12345", 0, S("abcde"));
- test(S("abcde"), 5, "12345", 1, S("abcde1"));
- test(S("abcde"), 5, "12345", 2, S("abcde12"));
- test(S("abcde"), 5, "12345", 4, S("abcde1234"));
- test(S("abcde"), 5, "12345", 5, S("abcde12345"));
- test(S("abcde"), 5, "1234567890", 0, S("abcde"));
- test(S("abcde"), 5, "1234567890", 1, S("abcde1"));
- test(S("abcde"), 5, "1234567890", 5, S("abcde12345"));
- test(S("abcde"), 5, "1234567890", 9, S("abcde123456789"));
- test(S("abcde"), 5, "1234567890", 10, S("abcde1234567890"));
- test(S("abcde"), 5, "12345678901234567890", 0, S("abcde"));
- test(S("abcde"), 5, "12345678901234567890", 1, S("abcde1"));
- test(S("abcde"), 5, "12345678901234567890", 10, S("abcde1234567890"));
- test(S("abcde"), 5, "12345678901234567890", 19, S("abcde1234567890123456789"));
- test(S("abcde"), 5, "12345678901234567890", 20, S("abcde12345678901234567890"));
- test(S("abcde"), 6, "", 0, S("can't happen"));
- test(S("abcde"), 6, "12345", 0, S("can't happen"));
- test(S("abcde"), 6, "12345", 1, S("can't happen"));
- test(S("abcde"), 6, "12345", 2, S("can't happen"));
- test(S("abcde"), 6, "12345", 4, S("can't happen"));
- test(S("abcde"), 6, "12345", 5, S("can't happen"));
- test(S("abcde"), 6, "1234567890", 0, S("can't happen"));
- test(S("abcde"), 6, "1234567890", 1, S("can't happen"));
- test(S("abcde"), 6, "1234567890", 5, S("can't happen"));
- test(S("abcde"), 6, "1234567890", 9, S("can't happen"));
- test(S("abcde"), 6, "1234567890", 10, S("can't happen"));
- test(S("abcde"), 6, "12345678901234567890", 0, S("can't happen"));
- test(S("abcde"), 6, "12345678901234567890", 1, S("can't happen"));
- test(S("abcde"), 6, "12345678901234567890", 10, S("can't happen"));
- test(S("abcde"), 6, "12345678901234567890", 19, S("can't happen"));
- test(S("abcde"), 6, "12345678901234567890", 20, S("can't happen"));
- test(S("abcdefghij"), 0, "", 0, S("abcdefghij"));
- test(S("abcdefghij"), 0, "12345", 0, S("abcdefghij"));
- test(S("abcdefghij"), 0, "12345", 1, S("1abcdefghij"));
- test(S("abcdefghij"), 0, "12345", 2, S("12abcdefghij"));
- test(S("abcdefghij"), 0, "12345", 4, S("1234abcdefghij"));
- test(S("abcdefghij"), 0, "12345", 5, S("12345abcdefghij"));
- test(S("abcdefghij"), 0, "1234567890", 0, S("abcdefghij"));
- test(S("abcdefghij"), 0, "1234567890", 1, S("1abcdefghij"));
- test(S("abcdefghij"), 0, "1234567890", 5, S("12345abcdefghij"));
- test(S("abcdefghij"), 0, "1234567890", 9, S("123456789abcdefghij"));
- test(S("abcdefghij"), 0, "1234567890", 10, S("1234567890abcdefghij"));
- test(S("abcdefghij"), 0, "12345678901234567890", 0, S("abcdefghij"));
- test(S("abcdefghij"), 0, "12345678901234567890", 1, S("1abcdefghij"));
- test(S("abcdefghij"), 0, "12345678901234567890", 10, S("1234567890abcdefghij"));
- test(S("abcdefghij"), 0, "12345678901234567890", 19, S("1234567890123456789abcdefghij"));
- test(S("abcdefghij"), 0, "12345678901234567890", 20, S("12345678901234567890abcdefghij"));
- test(S("abcdefghij"), 1, "", 0, S("abcdefghij"));
- test(S("abcdefghij"), 1, "12345", 0, S("abcdefghij"));
- test(S("abcdefghij"), 1, "12345", 1, S("a1bcdefghij"));
- test(S("abcdefghij"), 1, "12345", 2, S("a12bcdefghij"));
- test(S("abcdefghij"), 1, "12345", 4, S("a1234bcdefghij"));
- test(S("abcdefghij"), 1, "12345", 5, S("a12345bcdefghij"));
- test(S("abcdefghij"), 1, "1234567890", 0, S("abcdefghij"));
- test(S("abcdefghij"), 1, "1234567890", 1, S("a1bcdefghij"));
- test(S("abcdefghij"), 1, "1234567890", 5, S("a12345bcdefghij"));
- test(S("abcdefghij"), 1, "1234567890", 9, S("a123456789bcdefghij"));
- test(S("abcdefghij"), 1, "1234567890", 10, S("a1234567890bcdefghij"));
- test(S("abcdefghij"), 1, "12345678901234567890", 0, S("abcdefghij"));
- test(S("abcdefghij"), 1, "12345678901234567890", 1, S("a1bcdefghij"));
- test(S("abcdefghij"), 1, "12345678901234567890", 10, S("a1234567890bcdefghij"));
- test(S("abcdefghij"), 1, "12345678901234567890", 19, S("a1234567890123456789bcdefghij"));
- test(S("abcdefghij"), 1, "12345678901234567890", 20, S("a12345678901234567890bcdefghij"));
- test(S("abcdefghij"), 5, "", 0, S("abcdefghij"));
- test(S("abcdefghij"), 5, "12345", 0, S("abcdefghij"));
- test(S("abcdefghij"), 5, "12345", 1, S("abcde1fghij"));
- test(S("abcdefghij"), 5, "12345", 2, S("abcde12fghij"));
- test(S("abcdefghij"), 5, "12345", 4, S("abcde1234fghij"));
- test(S("abcdefghij"), 5, "12345", 5, S("abcde12345fghij"));
- test(S("abcdefghij"), 5, "1234567890", 0, S("abcdefghij"));
- test(S("abcdefghij"), 5, "1234567890", 1, S("abcde1fghij"));
- test(S("abcdefghij"), 5, "1234567890", 5, S("abcde12345fghij"));
- test(S("abcdefghij"), 5, "1234567890", 9, S("abcde123456789fghij"));
- test(S("abcdefghij"), 5, "1234567890", 10, S("abcde1234567890fghij"));
- test(S("abcdefghij"), 5, "12345678901234567890", 0, S("abcdefghij"));
- test(S("abcdefghij"), 5, "12345678901234567890", 1, S("abcde1fghij"));
- test(S("abcdefghij"), 5, "12345678901234567890", 10, S("abcde1234567890fghij"));
- test(S("abcdefghij"), 5, "12345678901234567890", 19, S("abcde1234567890123456789fghij"));
- test(S("abcdefghij"), 5, "12345678901234567890", 20, S("abcde12345678901234567890fghij"));
- test(S("abcdefghij"), 9, "", 0, S("abcdefghij"));
- test(S("abcdefghij"), 9, "12345", 0, S("abcdefghij"));
- test(S("abcdefghij"), 9, "12345", 1, S("abcdefghi1j"));
- test(S("abcdefghij"), 9, "12345", 2, S("abcdefghi12j"));
- test(S("abcdefghij"), 9, "12345", 4, S("abcdefghi1234j"));
- test(S("abcdefghij"), 9, "12345", 5, S("abcdefghi12345j"));
- test(S("abcdefghij"), 9, "1234567890", 0, S("abcdefghij"));
- test(S("abcdefghij"), 9, "1234567890", 1, S("abcdefghi1j"));
- test(S("abcdefghij"), 9, "1234567890", 5, S("abcdefghi12345j"));
- test(S("abcdefghij"), 9, "1234567890", 9, S("abcdefghi123456789j"));
- test(S("abcdefghij"), 9, "1234567890", 10, S("abcdefghi1234567890j"));
- test(S("abcdefghij"), 9, "12345678901234567890", 0, S("abcdefghij"));
- test(S("abcdefghij"), 9, "12345678901234567890", 1, S("abcdefghi1j"));
- test(S("abcdefghij"), 9, "12345678901234567890", 10, S("abcdefghi1234567890j"));
- test(S("abcdefghij"), 9, "12345678901234567890", 19, S("abcdefghi1234567890123456789j"));
- test(S("abcdefghij"), 9, "12345678901234567890", 20, S("abcdefghi12345678901234567890j"));
- test(S("abcdefghij"), 10, "", 0, S("abcdefghij"));
- test(S("abcdefghij"), 10, "12345", 0, S("abcdefghij"));
- test(S("abcdefghij"), 10, "12345", 1, S("abcdefghij1"));
- test(S("abcdefghij"), 10, "12345", 2, S("abcdefghij12"));
- test(S("abcdefghij"), 10, "12345", 4, S("abcdefghij1234"));
- test(S("abcdefghij"), 10, "12345", 5, S("abcdefghij12345"));
- test(S("abcdefghij"), 10, "1234567890", 0, S("abcdefghij"));
- test(S("abcdefghij"), 10, "1234567890", 1, S("abcdefghij1"));
- test(S("abcdefghij"), 10, "1234567890", 5, S("abcdefghij12345"));
- test(S("abcdefghij"), 10, "1234567890", 9, S("abcdefghij123456789"));
- test(S("abcdefghij"), 10, "1234567890", 10, S("abcdefghij1234567890"));
- test(S("abcdefghij"), 10, "12345678901234567890", 0, S("abcdefghij"));
- test(S("abcdefghij"), 10, "12345678901234567890", 1, S("abcdefghij1"));
- test(S("abcdefghij"), 10, "12345678901234567890", 10, S("abcdefghij1234567890"));
- test(S("abcdefghij"), 10, "12345678901234567890", 19, S("abcdefghij1234567890123456789"));
- test(S("abcdefghij"), 10, "12345678901234567890", 20, S("abcdefghij12345678901234567890"));
- test(S("abcdefghij"), 11, "", 0, S("can't happen"));
- test(S("abcdefghij"), 11, "12345", 0, S("can't happen"));
- test(S("abcdefghij"), 11, "12345", 1, S("can't happen"));
- test(S("abcdefghij"), 11, "12345", 2, S("can't happen"));
- test(S("abcdefghij"), 11, "12345", 4, S("can't happen"));
- test(S("abcdefghij"), 11, "12345", 5, S("can't happen"));
- test(S("abcdefghij"), 11, "1234567890", 0, S("can't happen"));
- test(S("abcdefghij"), 11, "1234567890", 1, S("can't happen"));
- test(S("abcdefghij"), 11, "1234567890", 5, S("can't happen"));
- test(S("abcdefghij"), 11, "1234567890", 9, S("can't happen"));
- test(S("abcdefghij"), 11, "1234567890", 10, S("can't happen"));
- test(S("abcdefghij"), 11, "12345678901234567890", 0, S("can't happen"));
- test(S("abcdefghij"), 11, "12345678901234567890", 1, S("can't happen"));
- test(S("abcdefghij"), 11, "12345678901234567890", 10, S("can't happen"));
- test(S("abcdefghij"), 11, "12345678901234567890", 19, S("can't happen"));
- test(S("abcdefghij"), 11, "12345678901234567890", 20, S("can't happen"));
- test(S("abcdefghijklmnopqrst"), 0, "", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 0, "12345", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 0, "12345", 1, S("1abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 0, "12345", 2, S("12abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 0, "12345", 4, S("1234abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 0, "12345", 5, S("12345abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 0, "1234567890", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 0, "1234567890", 1, S("1abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 0, "1234567890", 5, S("12345abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 0, "1234567890", 9, S("123456789abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 0, "1234567890", 10, S("1234567890abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 0, "12345678901234567890", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 0, "12345678901234567890", 1, S("1abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 0, "12345678901234567890", 10, S("1234567890abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 0, "12345678901234567890", 19, S("1234567890123456789abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 0, "12345678901234567890", 20, S("12345678901234567890abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 1, "", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 1, "12345", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 1, "12345", 1, S("a1bcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 1, "12345", 2, S("a12bcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 1, "12345", 4, S("a1234bcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 1, "12345", 5, S("a12345bcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 1, "1234567890", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 1, "1234567890", 1, S("a1bcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 1, "1234567890", 5, S("a12345bcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 1, "1234567890", 9, S("a123456789bcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 1, "1234567890", 10, S("a1234567890bcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 1, "12345678901234567890", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 1, "12345678901234567890", 1, S("a1bcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 1, "12345678901234567890", 10, S("a1234567890bcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 1, "12345678901234567890", 19, S("a1234567890123456789bcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 1, "12345678901234567890", 20, S("a12345678901234567890bcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 10, "", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 10, "12345", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 10, "12345", 1, S("abcdefghij1klmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 10, "12345", 2, S("abcdefghij12klmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 10, "12345", 4, S("abcdefghij1234klmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 10, "12345", 5, S("abcdefghij12345klmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 10, "1234567890", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 10, "1234567890", 1, S("abcdefghij1klmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 10, "1234567890", 5, S("abcdefghij12345klmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 10, "1234567890", 9, S("abcdefghij123456789klmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 10, "1234567890", 10, S("abcdefghij1234567890klmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 10, "12345678901234567890", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 10, "12345678901234567890", 1, S("abcdefghij1klmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 10, "12345678901234567890", 10, S("abcdefghij1234567890klmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 10, "12345678901234567890", 19, S("abcdefghij1234567890123456789klmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 10, "12345678901234567890", 20, S("abcdefghij12345678901234567890klmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 19, "", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 19, "12345", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 19, "12345", 1, S("abcdefghijklmnopqrs1t"));
- test(S("abcdefghijklmnopqrst"), 19, "12345", 2, S("abcdefghijklmnopqrs12t"));
- test(S("abcdefghijklmnopqrst"), 19, "12345", 4, S("abcdefghijklmnopqrs1234t"));
- test(S("abcdefghijklmnopqrst"), 19, "12345", 5, S("abcdefghijklmnopqrs12345t"));
- test(S("abcdefghijklmnopqrst"), 19, "1234567890", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 19, "1234567890", 1, S("abcdefghijklmnopqrs1t"));
- test(S("abcdefghijklmnopqrst"), 19, "1234567890", 5, S("abcdefghijklmnopqrs12345t"));
- test(S("abcdefghijklmnopqrst"), 19, "1234567890", 9, S("abcdefghijklmnopqrs123456789t"));
- test(S("abcdefghijklmnopqrst"), 19, "1234567890", 10, S("abcdefghijklmnopqrs1234567890t"));
- test(S("abcdefghijklmnopqrst"), 19, "12345678901234567890", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 19, "12345678901234567890", 1, S("abcdefghijklmnopqrs1t"));
- test(S("abcdefghijklmnopqrst"), 19, "12345678901234567890", 10, S("abcdefghijklmnopqrs1234567890t"));
- test(S("abcdefghijklmnopqrst"), 19, "12345678901234567890", 19, S("abcdefghijklmnopqrs1234567890123456789t"));
- test(S("abcdefghijklmnopqrst"), 19, "12345678901234567890", 20, S("abcdefghijklmnopqrs12345678901234567890t"));
- test(S("abcdefghijklmnopqrst"), 20, "", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 20, "12345", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 20, "12345", 1, S("abcdefghijklmnopqrst1"));
- test(S("abcdefghijklmnopqrst"), 20, "12345", 2, S("abcdefghijklmnopqrst12"));
- test(S("abcdefghijklmnopqrst"), 20, "12345", 4, S("abcdefghijklmnopqrst1234"));
- test(S("abcdefghijklmnopqrst"), 20, "12345", 5, S("abcdefghijklmnopqrst12345"));
- test(S("abcdefghijklmnopqrst"), 20, "1234567890", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 20, "1234567890", 1, S("abcdefghijklmnopqrst1"));
- test(S("abcdefghijklmnopqrst"), 20, "1234567890", 5, S("abcdefghijklmnopqrst12345"));
- test(S("abcdefghijklmnopqrst"), 20, "1234567890", 9, S("abcdefghijklmnopqrst123456789"));
- test(S("abcdefghijklmnopqrst"), 20, "1234567890", 10, S("abcdefghijklmnopqrst1234567890"));
- test(S("abcdefghijklmnopqrst"), 20, "12345678901234567890", 0, S("abcdefghijklmnopqrst"));
- test(S("abcdefghijklmnopqrst"), 20, "12345678901234567890", 1, S("abcdefghijklmnopqrst1"));
- test(S("abcdefghijklmnopqrst"), 20, "12345678901234567890", 10, S("abcdefghijklmnopqrst1234567890"));
- test(S("abcdefghijklmnopqrst"), 20, "12345678901234567890", 19, S("abcdefghijklmnopqrst1234567890123456789"));
- test(S("abcdefghijklmnopqrst"), 20, "12345678901234567890", 20, S("abcdefghijklmnopqrst12345678901234567890"));
- test(S("abcdefghijklmnopqrst"), 21, "", 0, S("can't happen"));
- test(S("abcdefghijklmnopqrst"), 21, "12345", 0, S("can't happen"));
- test(S("abcdefghijklmnopqrst"), 21, "12345", 1, S("can't happen"));
- test(S("abcdefghijklmnopqrst"), 21, "12345", 2, S("can't happen"));
- test(S("abcdefghijklmnopqrst"), 21, "12345", 4, S("can't happen"));
- test(S("abcdefghijklmnopqrst"), 21, "12345", 5, S("can't happen"));
- test(S("abcdefghijklmnopqrst"), 21, "1234567890", 0, S("can't happen"));
- test(S("abcdefghijklmnopqrst"), 21, "1234567890", 1, S("can't happen"));
- test(S("abcdefghijklmnopqrst"), 21, "1234567890", 5, S("can't happen"));
- test(S("abcdefghijklmnopqrst"), 21, "1234567890", 9, S("can't happen"));
- test(S("abcdefghijklmnopqrst"), 21, "1234567890", 10, S("can't happen"));
- test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 0, S("can't happen"));
- test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 1, S("can't happen"));
- test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 10, S("can't happen"));
- test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 19, S("can't happen"));
- test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 20, S("can't happen"));
- }
-#if TEST_STD_VER >= 11
+template <class S>
+TEST_CONSTEXPR_CXX20 bool test() {
{
- typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), 0, "", 0, S(""));
test(S(""), 0, "12345", 0, S(""));
test(S(""), 0, "12345", 1, S("1"));
@@ -696,10 +374,8 @@ bool test() {
test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 19, S("can't happen"));
test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 20, S("can't happen"));
}
-#endif
{ // test inserting into self
- typedef std::string S;
S s_short = "123/";
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
@@ -719,9 +395,14 @@ bool test() {
int main(int, char**)
{
- test();
+ test<std::string>();
+#if TEST_STD_VER >= 11
+ test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>();
+#endif
+
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test<std::string>());
+ static_assert(test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp
index ef70cd644fbb0..f39342aca72c3 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// insert(size_type pos, size_type n, charT c);
+// insert(size_type pos, size_type n, charT c); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -32,7 +34,7 @@ test(S s, typename S::size_type pos, typename S::size_type n,
assert(s == expected);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -48,7 +50,7 @@ test(S s, typename S::size_type pos, typename S::size_type n,
#endif
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), 0, 0, '1', S(""));
@@ -225,7 +227,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp
index 27c2932b60225..081943c882513 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// insert(size_type pos1, const basic_string& str);
+// insert(size_type pos1, const basic_string& str); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -31,7 +33,7 @@ test(S s, typename S::size_type pos, S str, S expected)
assert(s == expected);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -47,7 +49,7 @@ test(S s, typename S::size_type pos, S str, S expected)
#endif
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), 0, S(""), S(""));
@@ -233,7 +235,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp
index 63c1ed89996d9..86ebc44ffc25c 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
// insert(size_type pos1, const basic_string<charT,traits,Allocator>& str,
-// size_type pos2, size_type n=npos);
+// size_type pos2, size_type n=npos); // constexpr since C++20
// the "=npos" was added in C++14
#include <string>
@@ -34,7 +36,7 @@ test(S s, typename S::size_type pos1, S str, typename S::size_type pos2,
assert(s == expected);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -63,7 +65,7 @@ test_npos(S s, typename S::size_type pos1, S str, typename S::size_type pos2, S
assert(s == expected);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -1824,37 +1826,37 @@ void test() {
test30<S>();
#if TEST_STD_VER > 17
- // static_assert(test0<S>());
- // static_assert(test1<S>());
- // static_assert(test2<S>());
- // static_assert(test3<S>());
- // static_assert(test4<S>());
- // static_assert(test5<S>());
- // static_assert(test6<S>());
- // static_assert(test7<S>());
- // static_assert(test8<S>());
- // static_assert(test9<S>());
- // static_assert(test10<S>());
- // static_assert(test11<S>());
- // static_assert(test12<S>());
- // static_assert(test13<S>());
- // static_assert(test14<S>());
- // static_assert(test15<S>());
- // static_assert(test16<S>());
- // static_assert(test17<S>());
- // static_assert(test18<S>());
- // static_assert(test19<S>());
- // static_assert(test20<S>());
- // static_assert(test21<S>());
- // static_assert(test22<S>());
- // static_assert(test23<S>());
- // static_assert(test24<S>());
- // static_assert(test25<S>());
- // static_assert(test26<S>());
- // static_assert(test27<S>());
- // static_assert(test28<S>());
- // static_assert(test29<S>());
- // static_assert(test30<S>());
+ static_assert(test0<S>());
+ static_assert(test1<S>());
+ static_assert(test2<S>());
+ static_assert(test3<S>());
+ static_assert(test4<S>());
+ static_assert(test5<S>());
+ static_assert(test6<S>());
+ static_assert(test7<S>());
+ static_assert(test8<S>());
+ static_assert(test9<S>());
+ static_assert(test10<S>());
+ static_assert(test11<S>());
+ static_assert(test12<S>());
+ static_assert(test13<S>());
+ static_assert(test14<S>());
+ static_assert(test15<S>());
+ static_assert(test16<S>());
+ static_assert(test17<S>());
+ static_assert(test18<S>());
+ static_assert(test19<S>());
+ static_assert(test20<S>());
+ static_assert(test21<S>());
+ static_assert(test22<S>());
+ static_assert(test23<S>());
+ static_assert(test24<S>());
+ static_assert(test25<S>());
+ static_assert(test26<S>());
+ static_assert(test27<S>());
+ static_assert(test28<S>());
+ static_assert(test29<S>());
+ static_assert(test30<S>());
#endif
}
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp
index 3b8e63b9a7fc1..c378d40d54819 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// insert(size_type pos, string_view sv);
+// insert(size_type pos, string_view sv); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -31,7 +33,7 @@ test(S s, typename S::size_type pos, SV sv, S expected)
assert(s == expected);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -47,7 +49,7 @@ test(S s, typename S::size_type pos, SV sv, S expected)
#endif
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -242,7 +244,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp
index 5c7c6f2565866..0a94782fb0564 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// basic_string<charT,traits,Allocator>& operator+=(charT c);
+// basic_string<charT,traits,Allocator>& operator+=(charT c); // constexpr since C++20
#include <string>
#include <cassert>
@@ -25,7 +27,7 @@ test(S s, typename S::value_type str, S expected)
assert(s == expected);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), 'a', S("a"));
@@ -50,7 +52,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp
index 86c45bbcb8b88..ba3048dcb9c97 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// UNSUPPORTED: c++03
// <string>
-// basic_string& operator+=(initializer_list<charT> il);
+// basic_string& operator+=(initializer_list<charT> il); // constexpr since C++20
#include <string>
#include <cassert>
@@ -18,7 +20,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
std::string s("123");
s += {'a', 'b', 'c'};
@@ -38,7 +40,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp
index 13055fbb96bf9..9b3a553b90873 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// basic_string<charT,traits,Allocator>& operator+=(const charT* s);
+// basic_string<charT,traits,Allocator>& operator+=(const charT* s); // constexpr since C++20
#include <string>
#include <cassert>
@@ -25,7 +27,7 @@ test(S s, const typename S::value_type* str, S expected)
assert(s == expected);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), "", S());
@@ -82,7 +84,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp
index 32ceb43597e1e..a48225ec0127b 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// operator+=(const basic_string<charT,traits,Allocator>& str);
+// operator+=(const basic_string<charT,traits,Allocator>& str); // constexpr since C++20
#include <string>
#include <cassert>
@@ -26,7 +28,7 @@ test(S s, S str, S expected)
assert(s == expected);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(), S(), S());
@@ -92,7 +94,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp
index 1f12a5ee942f2..e8ee33f028c1a 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// UNSUPPORTED: c++03
// <string>
-// basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<charT> il);
+// basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<charT> il); // constexpr since C++20
#include <string>
#include <cassert>
@@ -18,7 +20,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
std::string s("123def456");
s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'});
@@ -38,7 +40,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
index e11d6fa2174e8..46eda91323895 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class InputIterator>
// basic_string&
-// replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2);
+// replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2); // constexpr since C++20
#include <string>
#include <iterator>
@@ -63,7 +65,7 @@ test_exceptions(S s, typename S::size_type pos1, typename S::size_type n1, It f,
}
#endif
-const char* str = "12345678901234567890";
+TEST_CONSTEXPR const char* str = "12345678901234567890";
template <class S>
TEST_CONSTEXPR_CXX20 bool test0()
@@ -993,9 +995,9 @@ TEST_CONSTEXPR_CXX20 bool test8()
}
template <class S>
-bool test9() {
+TEST_CONSTEXPR_CXX20 bool test9() {
#ifndef TEST_HAS_NO_EXCEPTIONS
- { // test iterator operations that throw
+ if (!TEST_IS_CONSTANT_EVALUATED) { // test iterator operations that throw
typedef ThrowingIterator<char> TIter;
typedef cpp17_input_iterator<TIter> IIter;
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
@@ -1057,16 +1059,16 @@ void test() {
test9<S>();
#if TEST_STD_VER > 17
- // static_assert(test0<S>());
- // static_assert(test1<S>());
- // static_assert(test2<S>());
- // static_assert(test3<S>());
- // static_assert(test4<S>());
- // static_assert(test5<S>());
- // static_assert(test6<S>());
- // static_assert(test7<S>());
- // static_assert(test8<S>());
- // static_assert(test9<S>());
+ static_assert(test0<S>());
+ static_assert(test1<S>());
+ static_assert(test2<S>());
+ static_assert(test3<S>());
+ static_assert(test4<S>());
+ static_assert(test5<S>());
+ static_assert(test6<S>());
+ static_assert(test7<S>());
+ static_assert(test8<S>());
+ static_assert(test9<S>());
#endif
}
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp
index 12c789edec4b6..628aae152dccf 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// replace(const_iterator i1, const_iterator i2, const charT* s);
+// replace(const_iterator i1, const_iterator i2, const charT* s); // constexpr since C++20
#include <stdio.h>
@@ -266,7 +268,7 @@ TEST_CONSTEXPR_CXX20 void test2()
test(S("abcdefghijklmnopqrst"), 20, 0, "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890"));
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -305,7 +307,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp
index 61fdad88b4424..49d88d4beb821 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// replace(const_iterator i1, const_iterator i2, const charT* s, size_type n);
+// replace(const_iterator i1, const_iterator i2, const charT* s, size_type n); // constexpr since C++20
#include <string>
#include <algorithm>
@@ -962,7 +964,7 @@ TEST_CONSTEXPR_CXX20 bool test8()
}
template <class S>
-bool test9() {
+TEST_CONSTEXPR_CXX20 bool test9() {
S s_short = "123/";
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
@@ -993,16 +995,16 @@ void test() {
test9<S>();
#if TEST_STD_VER > 17
- // static_assert(test0<S>());
- // static_assert(test1<S>());
- // static_assert(test2<S>());
- // static_assert(test3<S>());
- // static_assert(test4<S>());
- // static_assert(test5<S>());
- // static_assert(test6<S>());
- // static_assert(test7<S>());
- // static_assert(test8<S>());
- // static_assert(test9<S>());
+ static_assert(test0<S>());
+ static_assert(test1<S>());
+ static_assert(test2<S>());
+ static_assert(test3<S>());
+ static_assert(test4<S>());
+ static_assert(test5<S>());
+ static_assert(test6<S>());
+ static_assert(test7<S>());
+ static_assert(test8<S>());
+ static_assert(test9<S>());
#endif
}
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp
index 772ad695a96d6..ce2e5a44f0d60 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// replace(const_iterator i1, const_iterator i2, size_type n, charT c);
+// replace(const_iterator i1, const_iterator i2, size_type n, charT c); // constexpr since C++20
#include <string>
#include <algorithm>
@@ -35,7 +37,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, typename S::size
}
template <class S>
-void test0()
+TEST_CONSTEXPR_CXX20 void test0()
{
test(S(""), 0, 0, 0, '3', S(""));
test(S(""), 0, 0, 5, '3', S("33333"));
@@ -140,7 +142,7 @@ void test0()
}
template <class S>
-void test1()
+TEST_CONSTEXPR_CXX20 void test1()
{
test(S("abcdefghij"), 1, 4, 0, '3', S("afghij"));
test(S("abcdefghij"), 1, 4, 5, '3', S("a33333fghij"));
@@ -245,7 +247,7 @@ void test1()
}
template <class S>
-void test2()
+TEST_CONSTEXPR_CXX20 void test2()
{
test(S("abcdefghijklmnopqrst"), 10, 10, 0, '3', S("abcdefghij"));
test(S("abcdefghijklmnopqrst"), 10, 10, 5, '3', S("abcdefghij33333"));
@@ -265,7 +267,7 @@ void test2()
test(S("abcdefghijklmnopqrst"), 20, 0, 20, '3', S("abcdefghijklmnopqrst33333333333333333333"));
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -288,7 +290,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp
index c83af379bddae..1db44dc07cb0b 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// replace(const_iterator i1, const_iterator i2, const basic_string& str);
+// replace(const_iterator i1, const_iterator i2, const basic_string& str); // constexpr since C++20
#include <string>
#include <algorithm>
@@ -34,7 +36,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expecte
}
template <class S>
-TEST_CONSTEXPR_CXX20 void test0()
+TEST_CONSTEXPR_CXX20 bool test0()
{
test(S(""), 0, 0, S(""), S(""));
test(S(""), 0, 0, S("12345"), S("12345"));
@@ -136,10 +138,12 @@ TEST_CONSTEXPR_CXX20 void test0()
test(S("abcdefghij"), 1, 1, S("12345"), S("a12345cdefghij"));
test(S("abcdefghij"), 1, 1, S("1234567890"), S("a1234567890cdefghij"));
test(S("abcdefghij"), 1, 1, S("12345678901234567890"), S("a12345678901234567890cdefghij"));
+
+ return true;
}
template <class S>
-TEST_CONSTEXPR_CXX20 void test1()
+TEST_CONSTEXPR_CXX20 bool test1()
{
test(S("abcdefghij"), 1, 4, S(""), S("afghij"));
test(S("abcdefghij"), 1, 4, S("12345"), S("a12345fghij"));
@@ -241,10 +245,12 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), S("abcdefghij12345t"));
test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), S("abcdefghij1234567890t"));
test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), S("abcdefghij12345678901234567890t"));
+
+ return true;
}
template <class S>
-TEST_CONSTEXPR_CXX20 void test2()
+TEST_CONSTEXPR_CXX20 bool test2()
{
test(S("abcdefghijklmnopqrst"), 10, 10, S(""), S("abcdefghij"));
test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), S("abcdefghij12345"));
@@ -262,23 +268,22 @@ TEST_CONSTEXPR_CXX20 void test2()
test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), S("abcdefghijklmnopqrst12345"));
test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), S("abcdefghijklmnopqrst1234567890"));
test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
+
+ return true;
}
-bool test() {
- {
- typedef std::string S;
- test0<S>();
- test1<S>();
- test2<S>();
- }
-#if TEST_STD_VER >= 11
+template <class S>
+void test() {
{
- typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
test1<S>();
test2<S>();
- }
+#if TEST_STD_VER > 17
+ static_assert(test0<S>());
+ static_assert(test1<S>());
+ static_assert(test2<S>());
#endif
+ }
#if TEST_STD_VER > 3
{ // LWG 2946
@@ -288,15 +293,13 @@ bool test() {
assert(s == "a");
}
#endif
-
- return true;
}
int main(int, char**)
{
- test();
-#if TEST_STD_VER > 17
- // static_assert(test());
+ test<std::string>();
+#if TEST_STD_VER >= 11
+ test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>();
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string_view.pass.cpp
index f170fe78b94b1..82ffa98171f34 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string_view.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// replace(const_iterator i1, const_iterator i2, basic_string_view<charT,traits> sv);
+// replace(const_iterator i1, const_iterator i2, basic_string_view<charT,traits> sv); // constexpr since C++20
#include <string>
#include <algorithm>
@@ -264,7 +266,7 @@ TEST_CONSTEXPR_CXX20 void test2()
test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -289,7 +291,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp
index a24b8c5657051..b322143c74b38 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template <class T>
// basic_string& replace(size_type pos1, size_type n1, const T& t,
-// size_type pos2, size_type n=npos);
+// size_type pos2, size_type n=npos); // constexpr since C++20
//
// Mostly we're testing string_view here
@@ -47,7 +49,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1,
assert(s.size() == old_size - xlen + rlen);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -83,7 +85,7 @@ test_npos(S s, typename S::size_type pos1, typename S::size_type n1,
assert(s.size() == old_size - xlen + rlen);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -5981,7 +5983,7 @@ TEST_CONSTEXPR_CXX20 bool test55()
return true;
}
-bool test56() {
+TEST_CONSTEXPR_CXX20 bool test56() {
typedef std::string S;
typedef std::string_view SV;
S s0 = "ABCD";
@@ -6017,7 +6019,7 @@ bool test56() {
}
template <class S, class SV>
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
test0<S, SV>();
test1<S, SV>();
test2<S, SV>();
@@ -6076,62 +6078,62 @@ bool test() {
test55<S, SV>();
#if TEST_STD_VER > 17
- // static_assert(test0<S, SV>());
- // static_assert(test1<S, SV>());
- // static_assert(test2<S, SV>());
- // static_assert(test3<S, SV>());
- // static_assert(test4<S, SV>());
- // static_assert(test5<S, SV>());
- // static_assert(test6<S, SV>());
- // static_assert(test7<S, SV>());
- // static_assert(test8<S, SV>());
- // static_assert(test9<S, SV>());
- // static_assert(test10<S, SV>());
- // static_assert(test11<S, SV>());
- // static_assert(test12<S, SV>());
- // static_assert(test13<S, SV>());
- // static_assert(test14<S, SV>());
- // static_assert(test15<S, SV>());
- // static_assert(test16<S, SV>());
- // static_assert(test17<S, SV>());
- // static_assert(test18<S, SV>());
- // static_assert(test19<S, SV>());
- // static_assert(test20<S, SV>());
- // static_assert(test21<S, SV>());
- // static_assert(test22<S, SV>());
- // static_assert(test23<S, SV>());
- // static_assert(test24<S, SV>());
- // static_assert(test25<S, SV>());
- // static_assert(test26<S, SV>());
- // static_assert(test27<S, SV>());
- // static_assert(test28<S, SV>());
- // static_assert(test29<S, SV>());
- // static_assert(test30<S, SV>());
- // static_assert(test31<S, SV>());
- // static_assert(test32<S, SV>());
- // static_assert(test33<S, SV>());
- // static_assert(test34<S, SV>());
- // static_assert(test35<S, SV>());
- // static_assert(test36<S, SV>());
- // static_assert(test37<S, SV>());
- // static_assert(test38<S, SV>());
- // static_assert(test39<S, SV>());
- // static_assert(test40<S, SV>());
- // static_assert(test41<S, SV>());
- // static_assert(test42<S, SV>());
- // static_assert(test43<S, SV>());
- // static_assert(test44<S, SV>());
- // static_assert(test45<S, SV>());
- // static_assert(test46<S, SV>());
- // static_assert(test47<S, SV>());
- // static_assert(test48<S, SV>());
- // static_assert(test49<S, SV>());
- // static_assert(test50<S, SV>());
- // static_assert(test51<S, SV>());
- // static_assert(test52<S, SV>());
- // static_assert(test53<S, SV>());
- // static_assert(test54<S, SV>());
- // static_assert(test55<S, SV>());
+ static_assert(test0<S, SV>());
+ static_assert(test1<S, SV>());
+ static_assert(test2<S, SV>());
+ static_assert(test3<S, SV>());
+ static_assert(test4<S, SV>());
+ static_assert(test5<S, SV>());
+ static_assert(test6<S, SV>());
+ static_assert(test7<S, SV>());
+ static_assert(test8<S, SV>());
+ static_assert(test9<S, SV>());
+ static_assert(test10<S, SV>());
+ static_assert(test11<S, SV>());
+ static_assert(test12<S, SV>());
+ static_assert(test13<S, SV>());
+ static_assert(test14<S, SV>());
+ static_assert(test15<S, SV>());
+ static_assert(test16<S, SV>());
+ static_assert(test17<S, SV>());
+ static_assert(test18<S, SV>());
+ static_assert(test19<S, SV>());
+ static_assert(test20<S, SV>());
+ static_assert(test21<S, SV>());
+ static_assert(test22<S, SV>());
+ static_assert(test23<S, SV>());
+ static_assert(test24<S, SV>());
+ static_assert(test25<S, SV>());
+ static_assert(test26<S, SV>());
+ static_assert(test27<S, SV>());
+ static_assert(test28<S, SV>());
+ static_assert(test29<S, SV>());
+ static_assert(test30<S, SV>());
+ static_assert(test31<S, SV>());
+ static_assert(test32<S, SV>());
+ static_assert(test33<S, SV>());
+ static_assert(test34<S, SV>());
+ static_assert(test35<S, SV>());
+ static_assert(test36<S, SV>());
+ static_assert(test37<S, SV>());
+ static_assert(test38<S, SV>());
+ static_assert(test39<S, SV>());
+ static_assert(test40<S, SV>());
+ static_assert(test41<S, SV>());
+ static_assert(test42<S, SV>());
+ static_assert(test43<S, SV>());
+ static_assert(test44<S, SV>());
+ static_assert(test45<S, SV>());
+ static_assert(test46<S, SV>());
+ static_assert(test47<S, SV>());
+ static_assert(test48<S, SV>());
+ static_assert(test49<S, SV>());
+ static_assert(test50<S, SV>());
+ static_assert(test51<S, SV>());
+ static_assert(test52<S, SV>());
+ static_assert(test53<S, SV>());
+ static_assert(test54<S, SV>());
+ static_assert(test55<S, SV>());
#endif
return true;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
index 20738827444f4..cb798eab21cc8 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// replace(size_type pos, size_type n1, const charT* s);
+// replace(size_type pos, size_type n1, const charT* s); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -36,7 +38,7 @@ test(S s, typename S::size_type pos, typename S::size_type n1,
assert(s.size() == old_size - xlen + rlen);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -53,7 +55,7 @@ test(S s, typename S::size_type pos, typename S::size_type n1,
}
template <class S>
-TEST_CONSTEXPR_CXX20 void test0()
+TEST_CONSTEXPR_CXX20 bool test0()
{
test(S(""), 0, 0, "", S(""));
test(S(""), 0, 0, "12345", S("12345"));
@@ -155,10 +157,12 @@ TEST_CONSTEXPR_CXX20 void test0()
test(S("abcde"), 5, 1, "12345", S("abcde12345"));
test(S("abcde"), 5, 1, "1234567890", S("abcde1234567890"));
test(S("abcde"), 5, 1, "12345678901234567890", S("abcde12345678901234567890"));
+
+ return true;
}
template <class S>
-TEST_CONSTEXPR_CXX20 void test1()
+TEST_CONSTEXPR_CXX20 bool test1()
{
test(S("abcde"), 6, 0, "", S("can't happen"));
test(S("abcde"), 6, 0, "12345", S("can't happen"));
@@ -260,10 +264,12 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("abcdefghij"), 11, 0, "12345", S("can't happen"));
test(S("abcdefghij"), 11, 0, "1234567890", S("can't happen"));
test(S("abcdefghij"), 11, 0, "12345678901234567890", S("can't happen"));
+
+ return true;
}
template <class S>
-TEST_CONSTEXPR_CXX20 void test2()
+TEST_CONSTEXPR_CXX20 bool test2()
{
test(S("abcdefghijklmnopqrst"), 0, 0, "", S("abcdefghijklmnopqrst"));
test(S("abcdefghijklmnopqrst"), 0, 0, "12345", S("12345abcdefghijklmnopqrst"));
@@ -361,32 +367,29 @@ TEST_CONSTEXPR_CXX20 void test2()
test(S("abcdefghijklmnopqrst"), 21, 0, "12345", S("can't happen"));
test(S("abcdefghijklmnopqrst"), 21, 0, "1234567890", S("can't happen"));
test(S("abcdefghijklmnopqrst"), 21, 0, "12345678901234567890", S("can't happen"));
+
+ return true;
}
-bool test() {
- {
- typedef std::string S;
- test0<S>();
- test1<S>();
- test2<S>();
- }
-#if TEST_STD_VER >= 11
+template <class S>
+void test() {
{
- typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
test1<S>();
test2<S>();
- }
+#if TEST_STD_VER > 17
+ static_assert(test0<S>());
+ static_assert(test1<S>());
+ static_assert(test2<S>());
#endif
-
- return true;
+ }
}
int main(int, char**)
{
- test();
-#if TEST_STD_VER > 17
- // static_assert(test());
+ test<std::string>();
+#if TEST_STD_VER >= 11
+ test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>();
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
index f57cb8778a5f8..b07d4f3f7778b 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// replace(size_type pos, size_type n1, const charT* s, size_type n2);
+// replace(size_type pos, size_type n1, const charT* s, size_type n2); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -37,7 +39,7 @@ test(S s, typename S::size_type pos, typename S::size_type n1,
assert(s.size() == old_size - xlen + rlen);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -1337,18 +1339,18 @@ void test() {
test11<S>();
#if TEST_STD_VER > 17
- // static_assert(test0<S>());
- // static_assert(test1<S>());
- // static_assert(test2<S>());
- // static_assert(test3<S>());
- // static_assert(test4<S>());
- // static_assert(test5<S>());
- // static_assert(test6<S>());
- // static_assert(test7<S>());
- // static_assert(test8<S>());
- // static_assert(test9<S>());
- // static_assert(test10<S>());
- // static_assert(test11<S>());
+ static_assert(test0<S>());
+ static_assert(test1<S>());
+ static_assert(test2<S>());
+ static_assert(test3<S>());
+ static_assert(test4<S>());
+ static_assert(test5<S>());
+ static_assert(test6<S>());
+ static_assert(test7<S>());
+ static_assert(test8<S>());
+ static_assert(test9<S>());
+ static_assert(test10<S>());
+ static_assert(test11<S>());
#endif
}
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
index b3702172953d4..448b6e3b108af 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// replace(size_type pos, size_type n1, size_type n2, charT c);
+// replace(size_type pos, size_type n1, size_type n2, charT c); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -37,7 +39,7 @@ test(S s, typename S::size_type pos, typename S::size_type n1,
assert(s.size() == old_size - xlen + rlen);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -54,7 +56,7 @@ test(S s, typename S::size_type pos, typename S::size_type n1,
}
template <class S>
-TEST_CONSTEXPR_CXX20 void test0()
+TEST_CONSTEXPR_CXX20 bool test0()
{
test(S(""), 0, 0, 0, '2', S(""));
test(S(""), 0, 0, 5, '2', S("22222"));
@@ -156,10 +158,12 @@ TEST_CONSTEXPR_CXX20 void test0()
test(S("abcde"), 5, 1, 5, '2', S("abcde22222"));
test(S("abcde"), 5, 1, 10, '2', S("abcde2222222222"));
test(S("abcde"), 5, 1, 20, '2', S("abcde22222222222222222222"));
+
+ return true;
}
template <class S>
-TEST_CONSTEXPR_CXX20 void test1()
+TEST_CONSTEXPR_CXX20 bool test1()
{
test(S("abcde"), 6, 0, 0, '2', S("can't happen"));
test(S("abcde"), 6, 0, 5, '2', S("can't happen"));
@@ -261,10 +265,12 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("abcdefghij"), 11, 0, 5, '2', S("can't happen"));
test(S("abcdefghij"), 11, 0, 10, '2', S("can't happen"));
test(S("abcdefghij"), 11, 0, 20, '2', S("can't happen"));
+
+ return true;
}
template <class S>
-TEST_CONSTEXPR_CXX20 void test2()
+TEST_CONSTEXPR_CXX20 bool test2()
{
test(S("abcdefghijklmnopqrst"), 0, 0, 0, '2', S("abcdefghijklmnopqrst"));
test(S("abcdefghijklmnopqrst"), 0, 0, 5, '2', S("22222abcdefghijklmnopqrst"));
@@ -362,32 +368,28 @@ TEST_CONSTEXPR_CXX20 void test2()
test(S("abcdefghijklmnopqrst"), 21, 0, 5, '2', S("can't happen"));
test(S("abcdefghijklmnopqrst"), 21, 0, 10, '2', S("can't happen"));
test(S("abcdefghijklmnopqrst"), 21, 0, 20, '2', S("can't happen"));
+
+ return true;
}
-bool test() {
- {
- typedef std::string S;
- test0<S>();
- test1<S>();
- test2<S>();
- }
-#if TEST_STD_VER >= 11
- {
- typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
- test0<S>();
- test1<S>();
- test2<S>();
- }
-#endif
+template <class S>
+void test() {
+ test0<S>();
+ test1<S>();
+ test2<S>();
- return true;
+#if TEST_STD_VER > 17
+ static_assert(test0<S>());
+ static_assert(test1<S>());
+ static_assert(test2<S>());
+#endif
}
int main(int, char**)
{
- test();
-#if TEST_STD_VER > 17
- // static_assert(test());
+ test<std::string>();
+#if TEST_STD_VER >= 11
+ test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>();
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
index 53c5794cc6cbb..5490b83777bbc 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// replace(size_type pos1, size_type n1, const basic_string<charT,traits,Allocator>& str);
+// replace(size_type pos1, size_type n1, const basic_string<charT,traits,Allocator>& str); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -35,7 +37,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expecte
assert(s.size() == old_size - xlen + rlen);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -52,7 +54,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expecte
}
template <class S>
-TEST_CONSTEXPR_CXX20 void test0()
+TEST_CONSTEXPR_CXX20 bool test0()
{
test(S(""), 0, 0, S(""), S(""));
test(S(""), 0, 0, S("12345"), S("12345"));
@@ -154,10 +156,12 @@ TEST_CONSTEXPR_CXX20 void test0()
test(S("abcde"), 5, 1, S("12345"), S("abcde12345"));
test(S("abcde"), 5, 1, S("1234567890"), S("abcde1234567890"));
test(S("abcde"), 5, 1, S("12345678901234567890"), S("abcde12345678901234567890"));
+
+ return true;
}
template <class S>
-TEST_CONSTEXPR_CXX20 void test1()
+TEST_CONSTEXPR_CXX20 bool test1()
{
test(S("abcde"), 6, 0, S(""), S("can't happen"));
test(S("abcde"), 6, 0, S("12345"), S("can't happen"));
@@ -259,10 +263,12 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("abcdefghij"), 11, 0, S("12345"), S("can't happen"));
test(S("abcdefghij"), 11, 0, S("1234567890"), S("can't happen"));
test(S("abcdefghij"), 11, 0, S("12345678901234567890"), S("can't happen"));
+
+ return true;
}
template <class S>
-TEST_CONSTEXPR_CXX20 void test2()
+TEST_CONSTEXPR_CXX20 bool test2()
{
test(S("abcdefghijklmnopqrst"), 0, 0, S(""), S("abcdefghijklmnopqrst"));
test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), S("12345abcdefghijklmnopqrst"));
@@ -360,23 +366,22 @@ TEST_CONSTEXPR_CXX20 void test2()
test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), S("can't happen"));
test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), S("can't happen"));
test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), S("can't happen"));
+
+ return true;
}
-bool test() {
- {
- typedef std::string S;
- test0<S>();
- test1<S>();
- test2<S>();
- }
-#if TEST_STD_VER >= 11
+template <class S>
+void test() {
{
- typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();
test1<S>();
test2<S>();
- }
+#if TEST_STD_VER > 17
+ static_assert(test0<S>());
+ static_assert(test1<S>());
+ static_assert(test2<S>());
#endif
+ }
#if TEST_STD_VER > 3
{ // LWG 2946
@@ -386,16 +391,13 @@ bool test() {
assert(s == "a");
}
#endif
-
- return true;
}
int main(int, char**)
{
- test();
-#if TEST_STD_VER > 17
- // static_assert(test());
+ test<std::string>();
+#if TEST_STD_VER >= 11
+ test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>();
#endif
-
return 0;
}
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
index 729fbabca7c71..fa831ae4fbe7e 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
// replace(size_type pos1, size_type n1, const basic_string<charT,traits,Allocator>& str,
-// size_type pos2, size_type n2=npos);
+// size_type pos2, size_type n2=npos); // constexpr since C++20
// the "=npos" was added in C++14
#include <string>
@@ -39,7 +41,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1,
assert(s.size() == old_size - xlen + rlen);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -73,7 +75,7 @@ test_npos(S s, typename S::size_type pos1, typename S::size_type n1,
assert(s.size() == old_size - xlen + rlen);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -6031,62 +6033,62 @@ void test() {
test55<S>();
#if TEST_STD_VER > 17
- // static_assert(test0<S>());
- // static_assert(test1<S>());
- // static_assert(test2<S>());
- // static_assert(test3<S>());
- // static_assert(test4<S>());
- // static_assert(test5<S>());
- // static_assert(test6<S>());
- // static_assert(test7<S>());
- // static_assert(test8<S>());
- // static_assert(test9<S>());
- // static_assert(test10<S>());
- // static_assert(test11<S>());
- // static_assert(test12<S>());
- // static_assert(test13<S>());
- // static_assert(test14<S>());
- // static_assert(test15<S>());
- // static_assert(test16<S>());
- // static_assert(test17<S>());
- // static_assert(test18<S>());
- // static_assert(test19<S>());
- // static_assert(test20<S>());
- // static_assert(test21<S>());
- // static_assert(test22<S>());
- // static_assert(test23<S>());
- // static_assert(test24<S>());
- // static_assert(test25<S>());
- // static_assert(test26<S>());
- // static_assert(test27<S>());
- // static_assert(test28<S>());
- // static_assert(test29<S>());
- // static_assert(test30<S>());
- // static_assert(test31<S>());
- // static_assert(test32<S>());
- // static_assert(test33<S>());
- // static_assert(test34<S>());
- // static_assert(test35<S>());
- // static_assert(test36<S>());
- // static_assert(test37<S>());
- // static_assert(test38<S>());
- // static_assert(test39<S>());
- // static_assert(test40<S>());
- // static_assert(test41<S>());
- // static_assert(test42<S>());
- // static_assert(test43<S>());
- // static_assert(test44<S>());
- // static_assert(test45<S>());
- // static_assert(test46<S>());
- // static_assert(test47<S>());
- // static_assert(test48<S>());
- // static_assert(test49<S>());
- // static_assert(test50<S>());
- // static_assert(test51<S>());
- // static_assert(test52<S>());
- // static_assert(test53<S>());
- // static_assert(test54<S>());
- // static_assert(test55<S>());
+ static_assert(test0<S>());
+ static_assert(test1<S>());
+ static_assert(test2<S>());
+ static_assert(test3<S>());
+ static_assert(test4<S>());
+ static_assert(test5<S>());
+ static_assert(test6<S>());
+ static_assert(test7<S>());
+ static_assert(test8<S>());
+ static_assert(test9<S>());
+ static_assert(test10<S>());
+ static_assert(test11<S>());
+ static_assert(test12<S>());
+ static_assert(test13<S>());
+ static_assert(test14<S>());
+ static_assert(test15<S>());
+ static_assert(test16<S>());
+ static_assert(test17<S>());
+ static_assert(test18<S>());
+ static_assert(test19<S>());
+ static_assert(test20<S>());
+ static_assert(test21<S>());
+ static_assert(test22<S>());
+ static_assert(test23<S>());
+ static_assert(test24<S>());
+ static_assert(test25<S>());
+ static_assert(test26<S>());
+ static_assert(test27<S>());
+ static_assert(test28<S>());
+ static_assert(test29<S>());
+ static_assert(test30<S>());
+ static_assert(test31<S>());
+ static_assert(test32<S>());
+ static_assert(test33<S>());
+ static_assert(test34<S>());
+ static_assert(test35<S>());
+ static_assert(test36<S>());
+ static_assert(test37<S>());
+ static_assert(test38<S>());
+ static_assert(test39<S>());
+ static_assert(test40<S>());
+ static_assert(test41<S>());
+ static_assert(test42<S>());
+ static_assert(test43<S>());
+ static_assert(test44<S>());
+ static_assert(test45<S>());
+ static_assert(test46<S>());
+ static_assert(test47<S>());
+ static_assert(test48<S>());
+ static_assert(test49<S>());
+ static_assert(test50<S>());
+ static_assert(test51<S>());
+ static_assert(test52<S>());
+ static_assert(test53<S>());
+ static_assert(test54<S>());
+ static_assert(test55<S>());
#endif
}
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp
index c586f1c2b6442..991b6692bf1cb 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// basic_string<charT,traits,Allocator>&
-// replace(size_type pos1, size_type n1, basic_string_view<charT,traits> sv);
+// replace(size_type pos1, size_type n1, basic_string_view<charT,traits> sv); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -35,7 +37,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, SV sv, S expecte
assert(s.size() == old_size - xlen + rlen);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -52,7 +54,7 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, SV sv, S expecte
}
template <class S, class SV>
-TEST_CONSTEXPR_CXX20 void test0()
+TEST_CONSTEXPR_CXX20 bool test0()
{
test(S(""), 0, 0, SV(""), S(""));
test(S(""), 0, 0, SV("12345"), S("12345"));
@@ -154,10 +156,12 @@ TEST_CONSTEXPR_CXX20 void test0()
test(S("abcde"), 5, 1, SV("12345"), S("abcde12345"));
test(S("abcde"), 5, 1, SV("1234567890"), S("abcde1234567890"));
test(S("abcde"), 5, 1, SV("12345678901234567890"), S("abcde12345678901234567890"));
+
+ return true;
}
template <class S, class SV>
-TEST_CONSTEXPR_CXX20 void test1()
+TEST_CONSTEXPR_CXX20 bool test1()
{
test(S("abcde"), 6, 0, SV(""), S("can't happen"));
test(S("abcde"), 6, 0, SV("12345"), S("can't happen"));
@@ -259,10 +263,12 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("abcdefghij"), 11, 0, SV("12345"), S("can't happen"));
test(S("abcdefghij"), 11, 0, SV("1234567890"), S("can't happen"));
test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), S("can't happen"));
+
+ return true;
}
template <class S, class SV>
-TEST_CONSTEXPR_CXX20 void test2()
+TEST_CONSTEXPR_CXX20 bool test2()
{
test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), S("abcdefghijklmnopqrst"));
test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), S("12345abcdefghijklmnopqrst"));
@@ -360,34 +366,30 @@ TEST_CONSTEXPR_CXX20 void test2()
test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), S("can't happen"));
test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), S("can't happen"));
test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), S("can't happen"));
+
+ return true;
}
-bool test() {
+template <class S>
+void test() {
{
- typedef std::string S;
typedef std::string_view SV;
test0<S, SV>();
test1<S, SV>();
test2<S, SV>();
- }
-#if TEST_STD_VER >= 11
- {
- typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
- typedef std::string_view SV;
- test0<S, SV>();
- test1<S, SV>();
- test2<S, SV>();
- }
+#if TEST_STD_VER > 17
+ static_assert(test0<S, SV>());
+ static_assert(test1<S, SV>());
+ static_assert(test2<S, SV>());
#endif
-
- return true;
+ }
}
int main(int, char**)
{
- test();
-#if TEST_STD_VER > 17
- // static_assert(test());
+ test<std::string>();
+#if TEST_STD_VER >= 11
+ test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>();
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp
index db6d80c52e60d..a59b9d98897a6 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// void swap(basic_string& s);
+// void swap(basic_string& s); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -31,7 +33,7 @@ test(S s1, S s2)
assert(s2 == s1_);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), S(""));
@@ -80,7 +82,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp
index 5fe15fbf23e24..ebcbc7072ad2b 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
// void swap(basic_string<charT,traits,Allocator>& lhs,
-// basic_string<charT,traits,Allocator>& rhs);
+// basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -33,7 +35,7 @@ test(S s1, S s2)
assert(s2 == s1_);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), S(""));
@@ -82,7 +84,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp
index 76d8c858b2780..de820028e2602 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp
@@ -12,11 +12,11 @@
// void swap(basic_string& c)
// noexcept(!allocator_type::propagate_on_container_swap::value ||
-// __is_nothrow_swappable<allocator_type>::value);
+// __is_nothrow_swappable<allocator_type>::value); // constexpr since C++20
//
// In C++17, the standard says that swap shall have:
// noexcept(allocator_traits<Allocator>::propagate_on_container_swap::value ||
-// allocator_traits<Allocator>::is_always_equal::value);
+// allocator_traits<Allocator>::is_always_equal::value); // constexpr since C++20
// This tests a conforming extension
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp
index b301a5055bb72..6136d1fdb2d5b 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
-// bool operator!=(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs);
+// bool operator!=(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20
#include <string>
#include <cassert>
@@ -24,7 +26,7 @@ test(const typename S::value_type* lhs, const S& rhs, bool x)
assert((lhs != rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test("", S(""), false);
@@ -73,7 +75,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_pointer.pass.cpp
index db79165d568d2..762372b6cbcdf 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_pointer.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
-// bool operator!=(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs);
+// bool operator!=(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs); // constexpr since C++20
#include <string>
#include <cassert>
@@ -24,7 +26,7 @@ test(const S& lhs, const typename S::value_type* rhs, bool x)
assert((lhs != rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), "", false);
@@ -73,7 +75,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_string.pass.cpp
index c5007fd15a58e..24b09c8a78803 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_string.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
// bool operator!=(const basic_string<charT,traits,Allocator>& lhs,
-// const basic_string<charT,traits,Allocator>& rhs);
+// const basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20
#include <string>
#include <cassert>
@@ -25,7 +27,7 @@ test(const S& lhs, const S& rhs, bool x)
assert((lhs != rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), S(""), false);
@@ -74,7 +76,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_string_view.pass.cpp
index 23990f1fb7750..b578a26c6a807 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_string_view.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// we get this comparison "for free" because the string implicitly converts to the string_view
@@ -23,7 +25,7 @@ test(const S& lhs, SV rhs, bool x)
assert((lhs != rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string SV;
@@ -74,7 +76,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_view_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_view_string.pass.cpp
index 1cb88d1786625..92eff72357d36 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_view_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/string_view_string.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// we get this comparison "for free" because the string implicitly converts to the string_view
@@ -23,7 +25,7 @@ test(SV lhs, const S& rhs, bool x)
assert((lhs != rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -74,7 +76,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/allocator_propagation.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/allocator_propagation.pass.cpp
index e25bff5fd7ad7..9293b854db03a 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/allocator_propagation.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/allocator_propagation.pass.cpp
@@ -46,7 +46,7 @@ class soccc_allocator {
};
template <class CharT>
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
using S = std::basic_string<CharT, std::char_traits<CharT>, soccc_allocator<CharT>>;
{
int soccc_lhs = 0;
@@ -190,9 +190,9 @@ int main(int, char**) {
test<wchar_t>();
#endif
#if TEST_STD_VER > 17
- // static_assert(test<char>());
+ static_assert(test<char>());
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
- // static_assert(test<wchar_t>());
+ static_assert(test<wchar_t>());
#endif
#endif
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp
index 42c4c134ac472..6b86a2cd0286d 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp
@@ -6,15 +6,17 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
// basic_string<charT,traits,Allocator>
-// operator+(charT lhs, const basic_string<charT,traits,Allocator>& rhs);
+// operator+(charT lhs, const basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20
// template<class charT, class traits, class Allocator>
// basic_string<charT,traits,Allocator>&&
-// operator+(charT lhs, basic_string<charT,traits,Allocator>&& rhs);
+// operator+(charT lhs, basic_string<charT,traits,Allocator>&& rhs); // constexpr since C++20
#include <string>
#include <utility>
@@ -35,7 +37,7 @@ TEST_CONSTEXPR_CXX20 void test1(typename S::value_type lhs, S&& rhs, const S& x)
}
#endif
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0('a', S(""), S("a"));
@@ -73,7 +75,7 @@ bool test() {
int main(int, char**) {
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp
index 5f0c67f7e3ee0..d4bce015cffbb 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp
@@ -6,15 +6,17 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
// basic_string<charT,traits,Allocator>
-// operator+(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs);
+// operator+(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20
// template<class charT, class traits, class Allocator>
// basic_string<charT,traits,Allocator>&&
-// operator+(const charT* lhs, basic_string<charT,traits,Allocator>&& rhs);
+// operator+(const charT* lhs, basic_string<charT,traits,Allocator>&& rhs); // constexpr since C++20
#include <string>
#include <utility>
@@ -35,7 +37,7 @@ TEST_CONSTEXPR_CXX20 void test1(const typename S::value_type* lhs, S&& rhs, cons
}
#endif
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0("", S(""), S(""));
@@ -134,7 +136,7 @@ bool test() {
int main(int, char**) {
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp
index 4f516b8667d59..4e38d0eefdd26 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp
@@ -6,15 +6,17 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
// basic_string<charT,traits,Allocator>
-// operator+(const basic_string<charT,traits,Allocator>& lhs, charT rhs);
+// operator+(const basic_string<charT,traits,Allocator>& lhs, charT rhs); // constexpr since C++20
// template<class charT, class traits, class Allocator>
// basic_string<charT,traits,Allocator>&&
-// operator+(basic_string<charT,traits,Allocator>&& lhs, charT rhs);
+// operator+(basic_string<charT,traits,Allocator>&& lhs, charT rhs); // constexpr since C++20
#include <string>
#include <utility>
@@ -35,7 +37,7 @@ TEST_CONSTEXPR_CXX20 void test1(S&& lhs, typename S::value_type rhs, const S& x)
}
#endif
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0(S(""), '1', S("1"));
@@ -73,7 +75,7 @@ bool test() {
int main(int, char**) {
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp
index 66e57c8ce7c3d..356165d45e8fb 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp
@@ -6,15 +6,17 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
// basic_string<charT,traits,Allocator>
-// operator+(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs);
+// operator+(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs); // constexpr since C++20
// template<class charT, class traits, class Allocator>
// basic_string<charT,traits,Allocator>&&
-// operator+(basic_string<charT,traits,Allocator>&& lhs, const charT* rhs);
+// operator+(basic_string<charT,traits,Allocator>&& lhs, const charT* rhs); // constexpr since C++20
#include <string>
#include <utility>
@@ -35,7 +37,7 @@ TEST_CONSTEXPR_CXX20 void test1(S&& lhs, const typename S::value_type* rhs, cons
}
#endif
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0(S(""), "", S(""));
@@ -133,7 +135,7 @@ bool test() {
int main(int, char**) {
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp
index bf6791e019aa0..7e00d5c2e2724 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp
@@ -6,27 +6,29 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
// basic_string<charT,traits,Allocator>
// operator+(const basic_string<charT,traits,Allocator>& lhs,
-// const basic_string<charT,traits,Allocator>& rhs);
+// const basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20
// template<class charT, class traits, class Allocator>
// basic_string<charT,traits,Allocator>&&
// operator+(const basic_string<charT,traits,Allocator>&& lhs,
-// const basic_string<charT,traits,Allocator>& rhs);
+// const basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20
// template<class charT, class traits, class Allocator>
// basic_string<charT,traits,Allocator>&&
// operator+(const basic_string<charT,traits,Allocator>& lhs,
-// const basic_string<charT,traits,Allocator>&& rhs);
+// const basic_string<charT,traits,Allocator>&& rhs); // constexpr since C++20
// template<class charT, class traits, class Allocator>
// basic_string<charT,traits,Allocator>&&
// operator+(const basic_string<charT,traits,Allocator>&& lhs,
-// const basic_string<charT,traits,Allocator>&& rhs);
+// const basic_string<charT,traits,Allocator>&& rhs); // constexpr since C++20
#include <string>
#include <utility>
@@ -57,7 +59,7 @@ TEST_CONSTEXPR_CXX20 void test3(S&& lhs, S&& rhs, const S& x) {
}
#endif
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0(S(""), S(""), S(""));
@@ -251,7 +253,7 @@ bool test() {
int main(int, char**) {
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/pointer_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/pointer_string.pass.cpp
index 1b9153168fd82..e46bab8275b4d 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/pointer_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/pointer_string.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
-// bool operator==(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs);
+// bool operator==(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20
#include <string>
#include <cassert>
@@ -24,7 +26,7 @@ test(const typename S::value_type* lhs, const S& rhs, bool x)
assert((lhs == rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test("", S(""), true);
@@ -73,7 +75,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_pointer.pass.cpp
index 9e6ddcf93d54d..859ec9912ab8b 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_pointer.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
-// bool operator==(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs);
+// bool operator==(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs); // constexpr since C++20
#include <string>
#include <cassert>
@@ -24,7 +26,7 @@ test(const S& lhs, const typename S::value_type* rhs, bool x)
assert((lhs == rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), "", true);
@@ -73,7 +75,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_string.pass.cpp
index aafabdec68a02..17670e3b27309 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_string.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
// bool operator==(const basic_string<charT,traits,Allocator>& lhs,
-// const basic_string<charT,traits,Allocator>& rhs);
+// const basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20
#include <string>
#include <cassert>
@@ -25,7 +27,7 @@ test(const S& lhs, const S& rhs, bool x)
assert((lhs == rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), S(""), true);
@@ -74,7 +76,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_string_view.pass.cpp
index be393ab5c4c0e..857d863c03cec 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_string_view.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// we get this comparison "for free" because the string implicitly converts to the string_view
@@ -23,7 +25,7 @@ test(const S& lhs, SV rhs, bool x)
assert((lhs == rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -74,7 +76,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_view_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_view_string.pass.cpp
index 36cd9e478b61b..3a66afcbcbaf0 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_view_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/string_view_string.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// we get this comparison "for free" because the string implicitly converts to the string_view
@@ -23,7 +25,7 @@ test(SV lhs, const S& rhs, bool x)
assert((lhs == rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -74,7 +76,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp
index 781aafca5d493..738bbecdac915 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
-// bool operator>(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs);
+// bool operator>(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20
#include <string>
#include <cassert>
@@ -24,7 +26,7 @@ test(const typename S::value_type* lhs, const S& rhs, bool x)
assert((lhs > rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test("", S(""), false);
@@ -73,7 +75,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp
index c1e5b5b18e3cb..9127417c9ba3e 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
-// bool operator>(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs);
+// bool operator>(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs); // constexpr since C++20
#include <string>
#include <cassert>
@@ -24,7 +26,7 @@ test(const S& lhs, const typename S::value_type* rhs, bool x)
assert((lhs > rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), "", false);
@@ -73,7 +75,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp
index 863ecec14580e..5075a6c425bea 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
// bool operator>(const basic_string<charT,traits,Allocator>& lhs,
-// const basic_string<charT,traits,Allocator>& rhs);
+// const basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20
#include <string>
#include <cassert>
@@ -25,7 +27,7 @@ test(const S& lhs, const S& rhs, bool x)
assert((lhs > rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), S(""), false);
@@ -74,7 +76,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string_view.pass.cpp
index 2220c11571b4a..c29ea60186920 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string_view.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// we get this comparison "for free" because the string implicitly converts to the string_view
@@ -23,7 +25,7 @@ test(const S& lhs, SV rhs, bool x)
assert((lhs > rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -74,7 +76,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_view_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_view_string.pass.cpp
index 18bec19a8df74..fd1f7f46d23f2 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_view_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt/string_view_string.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// we get this comparison "for free" because the string implicitly converts to the string_view
@@ -23,7 +25,7 @@ test(SV lhs, const S& rhs, bool x)
assert((lhs > rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -74,7 +76,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/pointer_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/pointer_string.pass.cpp
index 4ac1ddd9fecca..8caf3f8a53cbc 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/pointer_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/pointer_string.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
-// bool operator>=(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs);
+// bool operator>=(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20
#include <string>
#include <cassert>
@@ -24,7 +26,7 @@ test(const typename S::value_type* lhs, const S& rhs, bool x)
assert((lhs >= rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test("", S(""), true);
@@ -73,7 +75,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp
index 2d64d40a4a39b..44e88d4f62682 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
-// bool operator>=(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs);
+// bool operator>=(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs); // constexpr since C++20
#include <string>
#include <cassert>
@@ -24,7 +26,7 @@ test(const S& lhs, const typename S::value_type* rhs, bool x)
assert((lhs >= rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), "", true);
@@ -73,7 +75,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp
index 252a1f1325b56..e1d61d5052b61 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
// bool operator>=(const basic_string<charT,traits,Allocator>& lhs,
-// const basic_string<charT,traits,Allocator>& rhs);
+// const basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20
#include <string>
#include <cassert>
@@ -25,7 +27,7 @@ test(const S& lhs, const S& rhs, bool x)
assert((lhs >= rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), S(""), true);
@@ -74,7 +76,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string_view.pass.cpp
index f7fcc250c183d..990717bdca58c 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string_view.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// we get this comparison "for free" because the string implicitly converts to the string_view
@@ -23,7 +25,7 @@ test(const S& lhs, SV rhs, bool x)
assert((lhs >= rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -74,7 +76,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_view_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_view_string.pass.cpp
index e0c62c66fc6f1..2781d8079bf40 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_view_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_view_string.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// we get this comparison "for free" because the string implicitly converts to the string_view
@@ -23,7 +25,7 @@ test(SV lhs, const S& rhs, bool x)
assert((lhs >= rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -74,7 +76,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp
index 02f725c09a089..65c6993c90143 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
-// bool operator<(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs);
+// bool operator<(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20
#include <string>
#include <cassert>
@@ -24,7 +26,7 @@ test(const typename S::value_type* lhs, const S& rhs, bool x)
assert((lhs < rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test("", S(""), false);
@@ -73,7 +75,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp
index 6909cf884db9b..c44a6a3fb9040 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
-// bool operator<(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs);
+// bool operator<(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs); // constexpr since C++20
#include <string>
#include <cassert>
@@ -24,7 +26,7 @@ test(const S& lhs, const typename S::value_type* rhs, bool x)
assert((lhs < rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), "", false);
@@ -73,7 +75,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp
index 0cd4f64c81273..fea8443ac6c7f 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
// bool operator<(const basic_string<charT,traits,Allocator>& lhs,
-// const basic_string<charT,traits,Allocator>& rhs);
+// const basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20
#include <string>
#include <cassert>
@@ -25,7 +27,7 @@ test(const S& lhs, const S& rhs, bool x)
assert((lhs < rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), S(""), false);
@@ -74,7 +76,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string_view.pass.cpp
index 470ee16bec1e5..f00c7d3495e4d 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string_view.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// we get this comparison "for free" because the string implicitly converts to the string_view
@@ -23,7 +25,7 @@ test(const S& lhs, SV rhs, bool x)
assert((lhs < rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -74,7 +76,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_view_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_view_string.pass.cpp
index b0baab5085a2a..d8b00a737fd78 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_view_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt/string_view_string.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// we get this comparison "for free" because the string implicitly converts to the string_view
@@ -23,7 +25,7 @@ test(SV lhs, const S& rhs, bool x)
assert((lhs < rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -74,7 +76,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp
index 67c090d22a83b..88632370b9c1e 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
-// bool operator<=(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs);
+// bool operator<=(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20
#include <string>
#include <cassert>
@@ -24,7 +26,7 @@ test(const typename S::value_type* lhs, const S& rhs, bool x)
assert((lhs <= rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test("", S(""), true);
@@ -73,7 +75,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp
index 3a6ba9e0871bb..d3cc20f1b3d5f 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
-// bool operator<=(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs);
+// bool operator<=(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs); // constexpr since C++20
#include <string>
#include <cassert>
@@ -24,7 +26,7 @@ test(const S& lhs, const typename S::value_type* rhs, bool x)
assert((lhs <= rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), "", true);
@@ -73,7 +75,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp
index ddec31bd33555..6947809e4613f 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template<class charT, class traits, class Allocator>
// bool operator<=(const basic_string<charT,traits,Allocator>& lhs,
-// const basic_string<charT,traits,Allocator>& rhs);
+// const basic_string<charT,traits,Allocator>& rhs); // constexpr since C++20
#include <string>
#include <cassert>
@@ -25,7 +27,7 @@ test(const S& lhs, const S& rhs, bool x)
assert((lhs <= rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), S(""), true);
@@ -74,7 +76,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string_view.pass.cpp
index dfd8877a62bd2..3f2f1d4f17322 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string_view.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// we get this comparison "for free" because the string implicitly converts to the string_view
@@ -23,7 +25,7 @@ test(const S& lhs, SV rhs, bool x)
assert((lhs <= rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -74,7 +76,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_view_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_view_string.pass.cpp
index 527a45a199059..2dbc2aee35088 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_view_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_view_string.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// we get this comparison "for free" because the string implicitly converts to the string_view
@@ -23,7 +25,7 @@ test(SV lhs, const S& rhs, bool x)
assert((lhs <= rhs) == x);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -74,7 +76,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp
index 13a98fc314617..96f14b68880cc 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// const charT* c_str() const;
+// const charT* c_str() const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -31,7 +33,7 @@ test(const S& s)
assert(T::eq(str[0], typename S::value_type()));
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""));
@@ -56,7 +58,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string.accessors/data.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string.accessors/data.pass.cpp
index cb28c53982a20..1dd0a33aeed62 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string.accessors/data.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string.accessors/data.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// const charT* data() const;
-// charT* data(); // C++17
+// const charT* data() const; // constexpr since C++20
+// charT* data(); // C++17, constexpr since C++20
#include <string>
#include <cassert>
@@ -47,7 +49,7 @@ test_nonconst(S& s)
assert(T::eq(str[0], typename S::value_type()));
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test_const(S(""));
@@ -81,7 +83,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp
index 9adad2a9fe632..d35628606a878 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// allocator_type get_allocator() const;
+// allocator_type get_allocator() const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -24,7 +26,7 @@ test(const S& s, const typename S::allocator_type& a)
assert(s.get_allocator() == a);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef test_allocator<char> A;
typedef std::basic_string<char, std::char_traits<char>, A> S;
@@ -51,7 +53,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_compare/pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/pointer.pass.cpp
index 316f64bd66f2d..50b03ab2939df 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/pointer.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// int compare(const charT *s) const;
+// int compare(const charT *s) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -33,7 +35,7 @@ test(const S& s, const typename S::value_type* str, int x)
assert(sign(s.compare(str)) == sign(x));
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), "", 0);
@@ -82,7 +84,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp
index 81fc6ba5e5e21..803b1c48cb758 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// template <typename T>
// int compare(size_type pos1, size_type n1, const T& t,
-// size_type pos2, size_type n2=npos) const;
+// size_type pos2, size_type n2=npos) const; // constexpr since C++20
//
// Mostly we're testing string_view here
@@ -22,7 +24,7 @@
#include "test_macros.h"
-int sign(int x)
+TEST_CONSTEXPR_CXX20 int sign(int x)
{
if (x == 0)
return 0;
@@ -32,7 +34,7 @@ int sign(int x)
}
template <class S, class SV>
-void
+TEST_CONSTEXPR_CXX20 void
test(const S& s, typename S::size_type pos1, typename S::size_type n1,
SV sv, typename S::size_type pos2, typename S::size_type n2, int x)
{
@@ -40,7 +42,7 @@ test(const S& s, typename S::size_type pos1, typename S::size_type n1,
if (pos1 <= s.size() && pos2 <= sv.size())
assert(sign(s.compare(pos1, n1, sv, pos2, n2)) == sign(x));
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -56,7 +58,7 @@ test(const S& s, typename S::size_type pos1, typename S::size_type n1,
}
template <class S, class SV>
-void
+TEST_CONSTEXPR_CXX20 void
test_npos(const S& s, typename S::size_type pos1, typename S::size_type n1,
SV sv, typename S::size_type pos2, int x)
{
@@ -64,7 +66,7 @@ test_npos(const S& s, typename S::size_type pos1, typename S::size_type n1,
if (pos1 <= s.size() && pos2 <= sv.size())
assert(sign(s.compare(pos1, n1, sv, pos2)) == sign(x));
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -5952,155 +5954,161 @@ TEST_CONSTEXPR_CXX20 bool test55()
return true;
}
-int main(int, char**)
-{
- {
- typedef std::string S;
- typedef std::string_view SV;
- test0<S, SV>();
- test1<S, SV>();
- test2<S, SV>();
- test3<S, SV>();
- test4<S, SV>();
- test5<S, SV>();
- test6<S, SV>();
- test7<S, SV>();
- test8<S, SV>();
- test9<S, SV>();
- test10<S, SV>();
- test11<S, SV>();
- test12<S, SV>();
- test13<S, SV>();
- test14<S, SV>();
- test15<S, SV>();
- test16<S, SV>();
- test17<S, SV>();
- test18<S, SV>();
- test19<S, SV>();
- test20<S, SV>();
- test21<S, SV>();
- test22<S, SV>();
- test23<S, SV>();
- test24<S, SV>();
- test25<S, SV>();
- test26<S, SV>();
- test27<S, SV>();
- test28<S, SV>();
- test29<S, SV>();
- test30<S, SV>();
- test31<S, SV>();
- test32<S, SV>();
- test33<S, SV>();
- test34<S, SV>();
- test35<S, SV>();
- test36<S, SV>();
- test37<S, SV>();
- test38<S, SV>();
- test39<S, SV>();
- test40<S, SV>();
- test41<S, SV>();
- test42<S, SV>();
- test43<S, SV>();
- test44<S, SV>();
- test45<S, SV>();
- test46<S, SV>();
- test47<S, SV>();
- test48<S, SV>();
- test49<S, SV>();
- test50<S, SV>();
- test51<S, SV>();
- test52<S, SV>();
- test53<S, SV>();
- test54<S, SV>();
- test55<S, SV>();
- }
-#if TEST_STD_VER >= 11
- {
- typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
- typedef std::basic_string_view<char, std::char_traits<char>> SV;
- test0<S, SV>();
- test1<S, SV>();
- test2<S, SV>();
- test3<S, SV>();
- test4<S, SV>();
- test5<S, SV>();
- test6<S, SV>();
- test7<S, SV>();
- test8<S, SV>();
- test9<S, SV>();
- test10<S, SV>();
- test11<S, SV>();
- test12<S, SV>();
- test13<S, SV>();
- test14<S, SV>();
- test15<S, SV>();
- test16<S, SV>();
- test17<S, SV>();
- test18<S, SV>();
- test19<S, SV>();
- test20<S, SV>();
- test21<S, SV>();
- test22<S, SV>();
- test23<S, SV>();
- test24<S, SV>();
- test25<S, SV>();
- test26<S, SV>();
- test27<S, SV>();
- test28<S, SV>();
- test29<S, SV>();
- test30<S, SV>();
- test31<S, SV>();
- test32<S, SV>();
- test33<S, SV>();
- test34<S, SV>();
- test35<S, SV>();
- test36<S, SV>();
- test37<S, SV>();
- test38<S, SV>();
- test39<S, SV>();
- test40<S, SV>();
- test41<S, SV>();
- test42<S, SV>();
- test43<S, SV>();
- test44<S, SV>();
- test45<S, SV>();
- test46<S, SV>();
- test47<S, SV>();
- test48<S, SV>();
- test49<S, SV>();
- test50<S, SV>();
- test51<S, SV>();
- test52<S, SV>();
- test53<S, SV>();
- test54<S, SV>();
- test55<S, SV>();
- }
-#endif
- {
- typedef std::string S;
- typedef std::string_view SV;
- S s = "MNOP";
- SV sv = "CDEF";
- char arr[] = "MNOP";
+template <class S, class SV>
+TEST_CONSTEXPR_CXX20 bool test56() {
+ S s = "MNOP";
+ SV sv = "CDEF";
+ char arr[] = "MNOP";
// calls compare(pos, n1, const char *, 0)
- assert(s.compare(0, 4, "QRST", 0) > 0);
+ assert(s.compare(0, 4, "QRST", 0) > 0);
// calls compare(pos, n1, string("QRST"), 0, npos)
- assert(s.compare(0, 4, "QRST", 0, std::string::npos) < 0);
+ assert(s.compare(0, 4, "QRST", 0, std::string::npos) < 0);
// calls compare(pos, n1, T, 0, npos)
- assert(s.compare(0, 4, sv, 0) > 0);
+ assert(s.compare(0, 4, sv, 0) > 0);
// calls compare(pos, n1, T, 0, npos)
- assert(s.compare(0, 4, sv, 0, std::string::npos) > 0);
+ assert(s.compare(0, 4, sv, 0, std::string::npos) > 0);
// calls compare(pos, n1, const char *, 0)
- assert(s.compare(0, 4, arr, 0) > 0);
+ assert(s.compare(0, 4, arr, 0) > 0);
// calls compare(size, size, string(arr), 0, npos)
- assert(s.compare(0, 4, arr, 0, std::string::npos) == 0);
- }
+ assert(s.compare(0, 4, arr, 0, std::string::npos) == 0);
+
+ return true;
+}
+
+template <class S, class SV>
+void test() {
+ test0<S, SV>();
+ test1<S, SV>();
+ test2<S, SV>();
+ test3<S, SV>();
+ test4<S, SV>();
+ test5<S, SV>();
+ test6<S, SV>();
+ test7<S, SV>();
+ test8<S, SV>();
+ test9<S, SV>();
+ test10<S, SV>();
+ test11<S, SV>();
+ test12<S, SV>();
+ test13<S, SV>();
+ test14<S, SV>();
+ test15<S, SV>();
+ test16<S, SV>();
+ test17<S, SV>();
+ test18<S, SV>();
+ test19<S, SV>();
+ test20<S, SV>();
+ test21<S, SV>();
+ test22<S, SV>();
+ test23<S, SV>();
+ test24<S, SV>();
+ test25<S, SV>();
+ test26<S, SV>();
+ test27<S, SV>();
+ test28<S, SV>();
+ test29<S, SV>();
+ test30<S, SV>();
+ test31<S, SV>();
+ test32<S, SV>();
+ test33<S, SV>();
+ test34<S, SV>();
+ test35<S, SV>();
+ test36<S, SV>();
+ test37<S, SV>();
+ test38<S, SV>();
+ test39<S, SV>();
+ test40<S, SV>();
+ test41<S, SV>();
+ test42<S, SV>();
+ test43<S, SV>();
+ test44<S, SV>();
+ test45<S, SV>();
+ test46<S, SV>();
+ test47<S, SV>();
+ test48<S, SV>();
+ test49<S, SV>();
+ test50<S, SV>();
+ test51<S, SV>();
+ test52<S, SV>();
+ test53<S, SV>();
+ test54<S, SV>();
+ test55<S, SV>();
+ test56<S, SV>();
+
+#if TEST_STD_VER > 17
+ static_assert(test0<S, SV>());
+ static_assert(test1<S, SV>());
+ static_assert(test2<S, SV>());
+ static_assert(test3<S, SV>());
+ static_assert(test4<S, SV>());
+ static_assert(test5<S, SV>());
+ static_assert(test6<S, SV>());
+ static_assert(test7<S, SV>());
+ static_assert(test8<S, SV>());
+ static_assert(test9<S, SV>());
+ static_assert(test10<S, SV>());
+ static_assert(test11<S, SV>());
+ static_assert(test12<S, SV>());
+ static_assert(test13<S, SV>());
+ static_assert(test14<S, SV>());
+ static_assert(test15<S, SV>());
+ static_assert(test16<S, SV>());
+ static_assert(test17<S, SV>());
+ static_assert(test18<S, SV>());
+ static_assert(test19<S, SV>());
+ static_assert(test20<S, SV>());
+ static_assert(test21<S, SV>());
+ static_assert(test22<S, SV>());
+ static_assert(test23<S, SV>());
+ static_assert(test24<S, SV>());
+ static_assert(test25<S, SV>());
+ static_assert(test26<S, SV>());
+ static_assert(test27<S, SV>());
+ static_assert(test28<S, SV>());
+ static_assert(test29<S, SV>());
+ static_assert(test30<S, SV>());
+ static_assert(test31<S, SV>());
+ static_assert(test32<S, SV>());
+ static_assert(test33<S, SV>());
+ static_assert(test34<S, SV>());
+ static_assert(test35<S, SV>());
+ static_assert(test36<S, SV>());
+ static_assert(test37<S, SV>());
+ static_assert(test38<S, SV>());
+ static_assert(test39<S, SV>());
+ static_assert(test40<S, SV>());
+ static_assert(test41<S, SV>());
+ static_assert(test42<S, SV>());
+ static_assert(test43<S, SV>());
+ static_assert(test44<S, SV>());
+ static_assert(test45<S, SV>());
+ static_assert(test46<S, SV>());
+ static_assert(test47<S, SV>());
+ static_assert(test48<S, SV>());
+ static_assert(test49<S, SV>());
+ static_assert(test50<S, SV>());
+ static_assert(test51<S, SV>());
+ static_assert(test52<S, SV>());
+ static_assert(test53<S, SV>());
+ static_assert(test54<S, SV>());
+ static_assert(test55<S, SV>());
+ static_assert(test56<S, SV>());
+#endif
+}
+
+int main(int, char**)
+{
+ test<std::string, std::string_view>();
+#if TEST_STD_VER >= 11
+ test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>,
+ std::basic_string_view<char, std::char_traits<char>>>();
+#endif
return 0;
}
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp
index c5720f4b85ae3..493c8a095967d 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// int compare(size_type pos, size_type n1, const charT *s) const;
+// int compare(size_type pos, size_type n1, const charT *s) const; // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -35,7 +37,7 @@ test(const S& s, typename S::size_type pos1, typename S::size_type n1,
if (pos1 <= s.size())
assert(sign(s.compare(pos1, n1, str)) == sign(x));
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -51,7 +53,7 @@ test(const S& s, typename S::size_type pos1, typename S::size_type n1,
}
template <class S>
-void test0()
+TEST_CONSTEXPR_CXX20 void test0()
{
test(S(""), 0, 0, "", 0);
test(S(""), 0, 0, "abcde", -5);
@@ -156,7 +158,7 @@ void test0()
}
template <class S>
-void test1()
+TEST_CONSTEXPR_CXX20 void test1()
{
test(S("abcde"), 6, 0, "", 0);
test(S("abcde"), 6, 0, "abcde", 0);
@@ -261,7 +263,7 @@ void test1()
}
template <class S>
-void test2()
+TEST_CONSTEXPR_CXX20 void test2()
{
test(S("abcdefghijklmnopqrst"), 0, 0, "", 0);
test(S("abcdefghijklmnopqrst"), 0, 0, "abcde", -5);
@@ -361,7 +363,7 @@ void test2()
test(S("abcdefghijklmnopqrst"), 21, 0, "abcdefghijklmnopqrst", 0);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -384,7 +386,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp
index 7c1512af339bd..57e24134e081a 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// int compare(size_type pos, size_type n1, const charT *s, size_type n2) const;
+// int compare(size_type pos, size_type n1, const charT *s, size_type n2) const; // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -35,7 +37,7 @@ test(const S& s, typename S::size_type pos, typename S::size_type n1,
if (pos <= s.size())
assert(sign(s.compare(pos, n1, str, n2)) == sign(x));
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -1333,18 +1335,20 @@ void test() {
test10<S>();
test11<S>();
- // static_assert(test0<S>());
- // static_assert(test1<S>());
- // static_assert(test2<S>());
- // static_assert(test3<S>());
- // static_assert(test4<S>());
- // static_assert(test5<S>());
- // static_assert(test6<S>());
- // static_assert(test7<S>());
- // static_assert(test8<S>());
- // static_assert(test9<S>());
- // static_assert(test10<S>());
- // static_assert(test11<S>());
+#if TEST_STD_VER > 17
+ static_assert(test0<S>());
+ static_assert(test1<S>());
+ static_assert(test2<S>());
+ static_assert(test3<S>());
+ static_assert(test4<S>());
+ static_assert(test5<S>());
+ static_assert(test6<S>());
+ static_assert(test7<S>());
+ static_assert(test8<S>());
+ static_assert(test9<S>());
+ static_assert(test10<S>());
+ static_assert(test11<S>());
+#endif
}
int main(int, char**)
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp
index e4c2dcd7b0be8..c62713e2791c6 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// int compare(size_type pos1, size_type n1, const basic_string& str) const;
+// int compare(size_type pos1, size_type n1, const basic_string& str) const; // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -17,7 +19,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int sign(int x)
+TEST_CONSTEXPR_CXX20 int sign(int x)
{
if (x == 0)
return 0;
@@ -27,14 +29,14 @@ int sign(int x)
}
template <class S>
-void
+TEST_CONSTEXPR_CXX20 void
test(const S& s, typename S::size_type pos1, typename S::size_type n1,
const S& str, int x)
{
if (pos1 <= s.size())
assert(sign(s.compare(pos1, n1, str)) == sign(x));
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -50,7 +52,7 @@ test(const S& s, typename S::size_type pos1, typename S::size_type n1,
}
template <class S>
-void test0()
+TEST_CONSTEXPR_CXX20 void test0()
{
test(S(""), 0, 0, S(""), 0);
test(S(""), 0, 0, S("abcde"), -5);
@@ -155,7 +157,7 @@ void test0()
}
template <class S>
-void test1()
+TEST_CONSTEXPR_CXX20 void test1()
{
test(S("abcde"), 6, 0, S(""), 0);
test(S("abcde"), 6, 0, S("abcde"), 0);
@@ -260,7 +262,7 @@ void test1()
}
template <class S>
-void test2()
+TEST_CONSTEXPR_CXX20 void test2()
{
test(S("abcdefghijklmnopqrst"), 0, 0, S(""), 0);
test(S("abcdefghijklmnopqrst"), 0, 0, S("abcde"), -5);
@@ -360,7 +362,7 @@ void test2()
test(S("abcdefghijklmnopqrst"), 21, 0, S("abcdefghijklmnopqrst"), 0);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -390,7 +392,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp
index 7a5cd6a11ad2a..78064cbec5a3d 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
// int compare(size_type pos1, size_type n1, const basic_string& str,
-// size_type pos2, size_type n2=npos) const;
+// size_type pos2, size_type n2=npos) const; // constexpr since C++20
// the "=npos" was added in C++14
#include <string>
@@ -37,7 +39,7 @@ test(const S& s, typename S::size_type pos1, typename S::size_type n1,
if (pos1 <= s.size() && pos2 <= str.size())
assert(sign(s.compare(pos1, n1, str, pos2, n2)) == sign(x));
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -53,14 +55,14 @@ test(const S& s, typename S::size_type pos1, typename S::size_type n1,
}
template <class S>
-void
+TEST_CONSTEXPR_CXX20 void
test_npos(const S& s, typename S::size_type pos1, typename S::size_type n1,
const S& str, typename S::size_type pos2, int x)
{
if (pos1 <= s.size() && pos2 <= str.size())
assert(sign(s.compare(pos1, n1, str, pos2)) == sign(x));
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -6007,62 +6009,64 @@ void test() {
test54<S>();
test55<S>();
- // static_assert(test0<S>());
- // static_assert(test1<S>());
- // static_assert(test2<S>());
- // static_assert(test3<S>());
- // static_assert(test4<S>());
- // static_assert(test5<S>());
- // static_assert(test6<S>());
- // static_assert(test7<S>());
- // static_assert(test8<S>());
- // static_assert(test9<S>());
- // static_assert(test10<S>());
- // static_assert(test11<S>());
- // static_assert(test12<S>());
- // static_assert(test13<S>());
- // static_assert(test14<S>());
- // static_assert(test15<S>());
- // static_assert(test16<S>());
- // static_assert(test17<S>());
- // static_assert(test18<S>());
- // static_assert(test19<S>());
- // static_assert(test20<S>());
- // static_assert(test21<S>());
- // static_assert(test22<S>());
- // static_assert(test23<S>());
- // static_assert(test24<S>());
- // static_assert(test25<S>());
- // static_assert(test26<S>());
- // static_assert(test27<S>());
- // static_assert(test28<S>());
- // static_assert(test29<S>());
- // static_assert(test30<S>());
- // static_assert(test31<S>());
- // static_assert(test32<S>());
- // static_assert(test33<S>());
- // static_assert(test34<S>());
- // static_assert(test35<S>());
- // static_assert(test36<S>());
- // static_assert(test37<S>());
- // static_assert(test38<S>());
- // static_assert(test39<S>());
- // static_assert(test40<S>());
- // static_assert(test41<S>());
- // static_assert(test42<S>());
- // static_assert(test43<S>());
- // static_assert(test44<S>());
- // static_assert(test45<S>());
- // static_assert(test46<S>());
- // static_assert(test47<S>());
- // static_assert(test48<S>());
- // static_assert(test49<S>());
- // static_assert(test50<S>());
- // static_assert(test51<S>());
- // static_assert(test52<S>());
- // static_assert(test53<S>());
- // static_assert(test54<S>());
- // static_assert(test55<S>());
+#if TEST_STD_VER > 17
+ static_assert(test0<S>());
+ static_assert(test1<S>());
+ static_assert(test2<S>());
+ static_assert(test3<S>());
+ static_assert(test4<S>());
+ static_assert(test5<S>());
+ static_assert(test6<S>());
+ static_assert(test7<S>());
+ static_assert(test8<S>());
+ static_assert(test9<S>());
+ static_assert(test10<S>());
+ static_assert(test11<S>());
+ static_assert(test12<S>());
+ static_assert(test13<S>());
+ static_assert(test14<S>());
+ static_assert(test15<S>());
+ static_assert(test16<S>());
+ static_assert(test17<S>());
+ static_assert(test18<S>());
+ static_assert(test19<S>());
+ static_assert(test20<S>());
+ static_assert(test21<S>());
+ static_assert(test22<S>());
+ static_assert(test23<S>());
+ static_assert(test24<S>());
+ static_assert(test25<S>());
+ static_assert(test26<S>());
+ static_assert(test27<S>());
+ static_assert(test28<S>());
+ static_assert(test29<S>());
+ static_assert(test30<S>());
+ static_assert(test31<S>());
+ static_assert(test32<S>());
+ static_assert(test33<S>());
+ static_assert(test34<S>());
+ static_assert(test35<S>());
+ static_assert(test36<S>());
+ static_assert(test37<S>());
+ static_assert(test38<S>());
+ static_assert(test39<S>());
+ static_assert(test40<S>());
+ static_assert(test41<S>());
+ static_assert(test42<S>());
+ static_assert(test43<S>());
+ static_assert(test44<S>());
+ static_assert(test45<S>());
+ static_assert(test46<S>());
+ static_assert(test47<S>());
+ static_assert(test48<S>());
+ static_assert(test49<S>());
+ static_assert(test50<S>());
+ static_assert(test51<S>());
+ static_assert(test52<S>());
+ static_assert(test53<S>());
+ static_assert(test54<S>());
+ static_assert(test55<S>());
+#endif
}
int main(int, char**)
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp
index 19d749535d920..6e127e7eab612 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// int compare(size_type pos1, size_type n1, basic_string_view sv) const;
+// int compare(size_type pos1, size_type n1, basic_string_view sv) const; // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -35,7 +37,7 @@ test(const S& s, typename S::size_type pos1, typename S::size_type n1,
if (pos1 <= s.size())
assert(sign(s.compare(pos1, n1, sv)) == sign(x));
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -361,7 +363,7 @@ TEST_CONSTEXPR_CXX20 void test2()
test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 0);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -386,7 +388,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_compare/string.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/string.pass.cpp
index f73a42188b3fc..c1c49d741025b 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/string.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// int compare(const basic_string& str) const
+// int compare(const basic_string& str) const // constexpr since C++20
#include <string>
#include <cassert>
@@ -33,7 +35,7 @@ test(const S& s, const S& str, int x)
assert(sign(s.compare(str)) == sign(x));
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), S(""), 0);
@@ -89,7 +91,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_compare/string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/string_view.pass.cpp
index af75b6c863a35..a411806c2529b 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/string_view.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// int compare(const basic_string_view sv) const
+// int compare(const basic_string_view sv) const // constexpr since C++20
#include <string>
#include <cassert>
@@ -33,7 +35,7 @@ test(const S& s, SV sv, int x)
assert(sign(s.compare(sv)) == sign(x));
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -84,7 +86,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp
index 996acf3774978..cb602c5db7f05 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_first_not_of(charT c, size_type pos = 0) const;
+// size_type find_first_not_of(charT c, size_type pos = 0) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -37,7 +39,7 @@ test(const S& s, typename S::value_type c, typename S::size_type x)
assert(x < s.size());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), 'q', 0, S::npos);
@@ -108,7 +110,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp
index 97a4d500811f0..6ad1566247ce3 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_first_not_of(const charT* s, size_type pos = 0) const;
+// size_type find_first_not_of(const charT* s, size_type pos = 0) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -142,7 +144,7 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", S::npos);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -163,7 +165,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp
index 0d6224f3ba63e..a48122d99c009 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_first_not_of(const charT* s, size_type pos, size_type n) const;
+// size_type find_first_not_of(const charT* s, size_type pos, size_type n) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -367,7 +369,7 @@ TEST_CONSTEXPR_CXX20 void test3()
test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, S::npos);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -392,7 +394,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp
index 6101dce71f477..98208a7980c07 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_first_not_of(const basic_string& str, size_type pos = 0) const;
+// size_type find_first_not_of(const basic_string& str, size_type pos = 0) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -142,7 +144,7 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), S::npos);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -170,7 +172,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_view_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_view_size.pass.cpp
index 01ce8bc3a1347..1b0cc549aac8b 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_view_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.not.of/string_view_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_first_not_of(basic_string_view sv, size_type pos = 0) const;
+// size_type find_first_not_of(basic_string_view sv, size_type pos = 0) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -142,7 +144,7 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("pniotcfrhqsmgdkjbael"), SV("htaobedqikfplcgjsmrn"), S::npos);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -165,7 +167,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp
index b3884ac423622..c478a113ab7b8 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_first_of(charT c, size_type pos = 0) const;
+// size_type find_first_of(charT c, size_type pos = 0) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -37,7 +39,7 @@ test(const S& s, typename S::value_type c, typename S::size_type x)
assert(x < s.size());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), 'e', 0, S::npos);
@@ -104,7 +106,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp
index 27952f1ded781..fe8fa2641cd38 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_first_of(const charT* s, size_type pos = 0) const;
+// size_type find_first_of(const charT* s, size_type pos = 0) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -143,7 +145,7 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", 0);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -164,7 +166,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp
index c815160df440d..9f172ffe3d1b7 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_first_of(const charT* s, size_type pos, size_type n) const;
+// size_type find_first_of(const charT* s, size_type pos, size_type n) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -367,7 +369,7 @@ TEST_CONSTEXPR_CXX20 void test3()
test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, S::npos);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -392,7 +394,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp
index 2f065d5f37978..6d24be01fe85e 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_first_of(const basic_string& str, size_type pos = 0) const;
+// size_type find_first_of(const basic_string& str, size_type pos = 0) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -142,7 +144,7 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), 0);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -170,7 +172,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/string_view_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/string_view_size.pass.cpp
index 762c11302f722..188587ad837ed 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/string_view_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.first.of/string_view_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_first_of(const basic_string_view sv, size_type pos = 0) const;
+// size_type find_first_of(const basic_string_view sv, size_type pos = 0) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -142,7 +144,7 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("pniotcfrhqsmgdkjbael"), SV("htaobedqikfplcgjsmrn"), 0);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -165,7 +167,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp
index e919f29c8611e..f243f36b54133 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_last_not_of(charT c, size_type pos = npos) const;
+// size_type find_last_not_of(charT c, size_type pos = npos) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -37,7 +39,7 @@ test(const S& s, typename S::value_type c, typename S::size_type x)
assert(x < s.size());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), 'i', 0, S::npos);
@@ -104,7 +106,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp
index 2d34815e5fcc3..2e4322344e5ed 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_last_not_of(const charT* s, size_type pos = npos) const;
+// size_type find_last_not_of(const charT* s, size_type pos = npos) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -143,7 +145,7 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", S::npos);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -164,7 +166,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp
index d0bfd8610c23b..905dc9e44d012 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_last_not_of(const charT* s, size_type pos, size_type n) const;
+// size_type find_last_not_of(const charT* s, size_type pos, size_type n) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -367,7 +369,7 @@ TEST_CONSTEXPR_CXX20 void test3()
test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, S::npos);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -392,7 +394,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp
index 25e20ff0340f1..9d3ffa0c2a128 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_last_not_of(const basic_string& str, size_type pos = npos) const;
+// size_type find_last_not_of(const basic_string& str, size_type pos = npos) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -142,7 +144,7 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), S::npos);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -170,7 +172,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_view_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_view_size.pass.cpp
index 4b274fe0a8a88..7ec022bb77676 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_view_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.not.of/string_view_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_last_not_of(basic_string_view sv, size_type pos = npos) const;
+// size_type find_last_not_of(basic_string_view sv, size_type pos = npos) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -142,7 +144,7 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("pniotcfrhqsmgdkjbael"), SV("htaobedqikfplcgjsmrn"), S::npos);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -151,10 +153,10 @@ bool test() {
}
#if TEST_STD_VER >= 11
{
-// typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
-// typedef std::string_view SV;
-// test0<S, SV>();
-// test1<S, SV>();
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::string_view SV;
+ test0<S, SV>();
+ test1<S, SV>();
}
#endif
@@ -165,7 +167,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp
index 0445d17c2a147..6ffad7eb994b7 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_last_of(charT c, size_type pos = npos) const;
+// size_type find_last_of(charT c, size_type pos = npos) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -37,7 +39,7 @@ test(const S& s, typename S::value_type c, typename S::size_type x)
assert(x < s.size());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), 'm', 0, S::npos);
@@ -104,7 +106,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp
index 5b288c429ea92..2a8a1ba8710a8 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_last_of(const charT* s, size_type pos = npos) const;
+// size_type find_last_of(const charT* s, size_type pos = npos) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -143,7 +145,7 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", 19);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -164,7 +166,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp
index 8ff4556e5383e..b6b724860c2dd 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_last_of(const charT* s, size_type pos, size_type n) const;
+// size_type find_last_of(const charT* s, size_type pos, size_type n) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -367,7 +369,7 @@ TEST_CONSTEXPR_CXX20 void test3()
test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, 19);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -392,7 +394,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp
index f65f9079a5df1..cb8cc7780d59f 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_last_of(const basic_string& str, size_type pos = npos) const;
+// size_type find_last_of(const basic_string& str, size_type pos = npos) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -142,7 +144,7 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), 19);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -170,7 +172,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/string_view_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/string_view_size.pass.cpp
index 1e0af418e8065..233ff8d22bfba 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/string_view_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find.last.of/string_view_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find_last_of(const basic_string_view sv, size_type pos = npos) const;
+// size_type find_last_of(const basic_string_view sv, size_type pos = npos) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -142,7 +144,7 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("pniotcfrhqsmgdkjbael"), SV("htaobedqikfplcgjsmrn"), 19);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -165,7 +167,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find/char_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find/char_size.pass.cpp
index e6f9e39b28a9f..0ec09164d3a5f 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find/char_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find/char_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find(charT c, size_type pos = 0) const;
+// size_type find(charT c, size_type pos = 0) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -37,7 +39,7 @@ test(const S& s, typename S::value_type c, typename S::size_type x)
assert(0 <= x && x + 1 <= s.size());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), 'c', 0, S::npos);
@@ -104,7 +106,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp
index cff4d75b2c9c3..46524f6d549d9 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find(const charT* s, size_type pos = 0) const;
+// size_type find(const charT* s, size_type pos = 0) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -149,7 +151,7 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -170,7 +172,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp
index 3ce531de52c90..72475e4a06ef3 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find(const charT* s, size_type pos, size_type n) const;
+// size_type find(const charT* s, size_type pos, size_type n) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -17,7 +19,7 @@
#include "min_allocator.h"
template <class S>
-void
+TEST_CONSTEXPR_CXX20 void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type n, typename S::size_type x)
{
@@ -367,7 +369,7 @@ TEST_CONSTEXPR_CXX20 void test3()
test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 20, S::npos);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -392,7 +394,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find/string_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find/string_size.pass.cpp
index edc2adb1e3aa8..0abdd04a9b412 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find/string_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find/string_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find(const basic_string& str, size_type pos = 0) const;
+// size_type find(const basic_string& str, size_type pos = 0) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -142,7 +144,7 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 0);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -170,7 +172,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_find/string_view_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_find/string_view_size.pass.cpp
index 2402e70e44abf..eff934d18f4f0 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_find/string_view_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_find/string_view_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type find(basic_string_view sv, size_type pos = 0) const;
+// size_type find(basic_string_view sv, size_type pos = 0) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -142,7 +144,7 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("abcdeabcdeabcdeabcde"), SV("abcdeabcdeabcdeabcde"), 0);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -165,7 +167,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp
index 77f4cbc4514ad..d4e04bf08de86 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type rfind(charT c, size_type pos = npos) const;
+// size_type rfind(charT c, size_type pos = npos) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -37,7 +39,7 @@ test(const S& s, typename S::value_type c, typename S::size_type x)
assert(x + 1 <= s.size());
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), 'b', 0, S::npos);
@@ -104,7 +106,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp
index c05844fcedd41..02661c3926b68 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type rfind(const charT* s, size_type pos = npos) const;
+// size_type rfind(const charT* s, size_type pos = npos) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -150,7 +152,7 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -171,7 +173,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp
index 339708979d09b..d3af64b76bb6b 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type rfind(const charT* s, size_type pos, size_type n) const;
+// size_type rfind(const charT* s, size_type pos, size_type n) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -367,7 +369,7 @@ TEST_CONSTEXPR_CXX20 void test3()
test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 20, 0);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -392,7 +394,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp
index 62a87562bd127..6041446499ddd 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type rfind(const basic_string& str, size_type pos = npos) const;
+// size_type rfind(const basic_string& str, size_type pos = npos) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -142,7 +144,7 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 0);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test0<S>();
@@ -170,7 +172,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_rfind/string_view_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/string_view_size.pass.cpp
index 541f8fbc73f25..59bee05873bad 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_rfind/string_view_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_rfind/string_view_size.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// size_type rfind(basic_string_view sv, size_type pos = npos) const;
+// size_type rfind(basic_string_view sv, size_type pos = npos) const; // constexpr since C++20
#include <string>
#include <cassert>
@@ -142,7 +144,7 @@ TEST_CONSTEXPR_CXX20 void test1()
test(S("abcdeabcdeabcdeabcde"), SV("abcdeabcdeabcdeabcde"), 0);
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
typedef std::string_view SV;
@@ -165,7 +167,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
index 00d29c0de0e38..8313acfc3c1d9 100644
--- a/libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
@@ -6,9 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <string>
-// basic_string substr(size_type pos = 0, size_type n = npos) const;
+// basic_string substr(size_type pos = 0, size_type n = npos) const; // constexpr since C++20
#include <string>
#include <stdexcept>
@@ -32,7 +34,7 @@ test(const S& s, typename S::size_type pos, typename S::size_type n)
assert(S::traits_type::compare(s.data()+pos, str.data(), rlen) == 0);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- else
+ else if (!TEST_IS_CONSTANT_EVALUATED)
{
try
{
@@ -47,7 +49,7 @@ test(const S& s, typename S::size_type pos, typename S::size_type n)
#endif
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test(S(""), 0, 0);
@@ -180,7 +182,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.require/contiguous.pass.cpp b/libcxx/test/std/strings/basic.string/string.require/contiguous.pass.cpp
index 250d23bfb1fc7..afd21fe40ae2b 100644
--- a/libcxx/test/std/strings/basic.string/string.require/contiguous.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.require/contiguous.pass.cpp
@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: LIBCXX-AIX-FIXME
+
// <array>
// An string is a contiguous container
@@ -19,13 +21,13 @@
template <class C>
-void test_contiguous ( const C &c )
+TEST_CONSTEXPR_CXX20 void test_contiguous ( const C &c )
{
for ( size_t i = 0; i < c.size(); ++i )
assert ( *(c.begin() + static_cast<typename C::
diff erence_type>(i)) == *(std::addressof(*c.begin()) + i));
}
-bool test() {
+TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::string S;
test_contiguous(S());
@@ -57,7 +59,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17
- // static_assert(test());
+ static_assert(test());
#endif
return 0;
diff --git a/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.char.pass.cpp b/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.char.pass.cpp
index 9f0f0d796a138..a3ad1fd94b63a 100644
--- a/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.char.pass.cpp
@@ -9,14 +9,14 @@
// <string>
-// bool starts_with(charT x) const noexcept;
+// constexpr bool starts_with(charT x) const noexcept;
#include <string>
#include <cassert>
#include "test_macros.h"
-bool test() {
+constexpr bool test() {
{
typedef std::string S;
S s1 {};
@@ -36,9 +36,7 @@ bool test() {
int main(int, char**)
{
test();
-#if TEST_STD_VER > 17
- // static_assert(test());
-#endif
+ static_assert(test());
return 0;
}
diff --git a/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.ptr.pass.cpp b/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.ptr.pass.cpp
index 05dd525374edf..50320355dd25d 100644
--- a/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.ptr.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.ptr.pass.cpp
@@ -9,14 +9,14 @@
// <string>
-// bool starts_with(const CharT *x) const;
+// constexpr bool starts_with(const CharT *x) const;
#include <string>
#include <cassert>
#include "test_macros.h"
-bool test() {
+constexpr bool test() {
{
typedef std::string S;
const char *s = "abcde";
@@ -64,9 +64,7 @@ bool test() {
int main(int, char**)
{
test();
-#if TEST_STD_VER > 17
- // static_assert(test());
-#endif
+ static_assert(test());
return 0;
}
diff --git a/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.string_view.pass.cpp
index 22ff1722311dd..c0734d090da7a 100644
--- a/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.string_view.pass.cpp
@@ -9,14 +9,14 @@
// <string>
-// bool starts_with(string_view x) const noexcept;
+// constexpr bool starts_with(string_view x) const noexcept;
#include <string>
#include <cassert>
#include "test_macros.h"
-bool test() {
+constexpr bool test() {
typedef std::string S;
typedef std::string_view SV;
const char *s = "abcde";
@@ -72,9 +72,7 @@ bool test() {
int main(int, char**)
{
test();
-#if TEST_STD_VER > 17
- // static_assert(test());
-#endif
+ static_assert(test());
return 0;
}
diff --git a/libcxx/test/support/constexpr_char_traits.h b/libcxx/test/support/constexpr_char_traits.h
index 390f8f7d0312b..5bf8fc8398cac 100644
--- a/libcxx/test/support/constexpr_char_traits.h
+++ b/libcxx/test/support/constexpr_char_traits.h
@@ -118,7 +118,8 @@ template <class _CharT>
TEST_CONSTEXPR_CXX14 _CharT*
constexpr_char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n)
{
- assert(__s2 < __s1 || __s2 >= __s1+__n);
+ if (!TEST_IS_CONSTANT_EVALUATED) // fails in constexpr because we might be comparing unrelated pointers
+ assert(__s2 < __s1 || __s2 >= __s1+__n);
char_type* __r = __s1;
for (; __n; --__n, ++__s1, ++__s2)
assign(*__s1, *__s2);
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index a83cab858cfec..fd8a52911f845 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -247,7 +247,7 @@ def add_version_header(tc):
"headers": ["numeric"],
}, {
"name": "__cpp_lib_constexpr_string",
- "values": { "c++20": 201811 }, # because P1032R1 is implemented; but should become 201907 after P0980R1
+ "values": { "c++20": 201907 },
"headers": ["string"],
}, {
"name": "__cpp_lib_constexpr_string_view",
More information about the libcxx-commits
mailing list