diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst --- a/libcxx/docs/FeatureTestMacroTable.rst +++ b/libcxx/docs/FeatureTestMacroTable.rst @@ -214,7 +214,7 @@ ------------------------------------------------- ----------------- ``__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 --- a/libcxx/docs/Status/Cxx20Papers.csv +++ b/libcxx/docs/Status/Cxx20Papers.csv @@ -106,7 +106,7 @@ "`P0645R10 `__","LWG","Text Formatting","Cologne","|Complete| [#note-P0645]_","14.0" "`P0660R10 `__","LWG","Stop Token and Joining Thread, Rev 10","Cologne","","" "`P0784R7 `__","CWG","More constexpr containers","Cologne","|Complete|","12.0" -"`P0980R1 `__","LWG","Making std::string constexpr","Cologne","","" +"`P0980R1 `__","LWG","Making std::string constexpr","Cologne","|Complete|","15.0" "`P1004R2 `__","LWG","Making std::vector constexpr","Cologne","","" "`P1035R7 `__","LWG","Input Range Adaptors","Cologne","","" "`P1065R2 `__","LWG","Constexpr INVOKE","Cologne","|Complete|","12.0" diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -575,23 +575,27 @@ template 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 +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator> operator+(const _CharT* __x, const basic_string<_CharT,_Traits,_Allocator>& __y); template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator> operator+(_CharT __x, const basic_string<_CharT,_Traits,_Allocator>& __y); template -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 +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator> operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y); @@ -674,8 +678,8 @@ typedef __wrap_iter iterator; typedef __wrap_iter const_iterator; - typedef _VSTD::reverse_iterator reverse_iterator; - typedef _VSTD::reverse_iterator const_reverse_iterator; + typedef _VSTD::reverse_iterator reverse_iterator; + typedef _VSTD::reverse_iterator const_reverse_iterator; private: @@ -766,21 +770,21 @@ _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::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::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::value); @@ -788,12 +792,12 @@ _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 ::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)); @@ -801,146 +805,151 @@ } template ::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 ::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::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::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::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::value> > - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string(_InputIterator __first, _InputIterator __last); template::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 ::value && !__is_same_uncvref<_Tp, basic_string>::value> > - basic_string& operator=(const _Tp& __t) - {__self_view __sv = __t; return assign(__sv);} + template ::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 __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(__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(__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 @@ -951,55 +960,67 @@ } #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 - _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 __il) {return append(__il);} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + basic_string& operator+=(initializer_list __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 - _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 - _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 @@ -1007,11 +1028,11 @@ 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 @@ -1021,7 +1042,7 @@ __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()); @@ -1034,41 +1055,40 @@ __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 __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 - _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 - _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 @@ -1076,11 +1096,11 @@ 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 - _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, @@ -1088,7 +1108,7 @@ > assign(_InputIterator __first, _InputIterator __last); template - _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, @@ -1096,15 +1116,15 @@ > assign(_ForwardIterator __first, _ForwardIterator __last); #ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& assign(initializer_list __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 - _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, @@ -1114,22 +1134,23 @@ { __self_view __sv = __t; return insert(__pos1, __sv.data(), __sv.size()); } template - _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 - _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, @@ -1137,7 +1158,7 @@ > insert(const_iterator __pos, _InputIterator __first, _InputIterator __last); template - _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, @@ -1145,45 +1166,47 @@ > 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 __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 - _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 - _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 - _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, @@ -1191,14 +1214,14 @@ > 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 - _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, @@ -1206,16 +1229,16 @@ > 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 __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; @@ -1224,123 +1247,129 @@ __is_nothrow_swappable::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 - _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 - _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 - _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 - _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 - _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 - _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 - _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, @@ -1349,7 +1378,7 @@ compare(const _Tp &__t) const _NOEXCEPT; template - _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, @@ -1357,20 +1386,23 @@ > 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 - 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 @@ -1413,15 +1445,46 @@ { 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 _LIBCPP_CONSTEXPR_AFTER_CXX17 void __clear_and_shrink() _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY void __shrink_or_extend(size_type __target_capacity); + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void __shrink_or_extend(size_type __target_capacity); - _LIBCPP_INLINE_VISIBILITY - bool __is_long() const _NOEXCEPT - {return bool(__r_.first().__s.__size_ & __short_mask);} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool __is_long() const _NOEXCEPT { + if (__libcpp_is_constant_evaluated()) + return true; + return bool(__r_.first().__s.__size_ & __short_mask); + } + + 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()); + } #if _LIBCPP_DEBUG_LEVEL == 2 @@ -1465,12 +1528,12 @@ 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(); } #ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void __set_short_size(size_type __s) _NOEXCEPT # ifdef _LIBCPP_BIG_ENDIAN {__r_.first().__s.__size_ = (unsigned char)(__s << 1);} @@ -1478,7 +1541,7 @@ {__r_.first().__s.__size_ = (unsigned char)(__s);} # endif - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type __get_short_size() const _NOEXCEPT # ifdef _LIBCPP_BIG_ENDIAN {return __r_.first().__s.__size_ >> 1;} @@ -1488,7 +1551,7 @@ #else // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void __set_short_size(size_type __s) _NOEXCEPT # ifdef _LIBCPP_BIG_ENDIAN {__r_.first().__s.__size_ = (unsigned char)(__s);} @@ -1496,7 +1559,7 @@ {__r_.first().__s.__size_ = (unsigned char)(__s << 1);} # endif - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type __get_short_size() const _NOEXCEPT # ifdef _LIBCPP_BIG_ENDIAN {return __r_.first().__s.__size_;} @@ -1506,73 +1569,79 @@ #endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT - _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_ = __long_mask | __s;} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type __get_long_cap() const _NOEXCEPT {return __r_.first().__l.__cap_ & size_type(~__long_mask);} - _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_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::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 { + size_type (&__a)[__n_words] = __r_.first().__r.__words; + if (__libcpp_is_constant_evaluated()) { + __r_.first() = __rep(); + return; } + for (unsigned __i = 0; __i < __n_words; ++__i) + __a[__i] = 0; + } template 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(__min_cap) - 1; + { + if (__libcpp_is_constant_evaluated()) + return __s + 1; + if (__s < __min_cap) + return static_cast(__min_cap) - 1; size_type __guess = __align_it (__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. @@ -1583,10 +1652,10 @@ // 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 - inline + inline _LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __is_exactly_cpp17_input_iterator<_InputIterator>::value @@ -1594,15 +1663,17 @@ __init(_InputIterator __first, _InputIterator __last); template - 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); @@ -1611,21 +1682,21 @@ // have proof that the input does not alias the current instance. // For example, operator=(basic_string) performs a 'self' check. template - 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());} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void __copy_assign_alloc(const basic_string& __str, true_type) { if (__alloc() == __str.__alloc()) @@ -1641,6 +1712,7 @@ { allocator_type __a = __str.__alloc(); pointer __p = __alloc_traits::allocate(__a, __str.__get_long_cap()); + __begin_lifetime(__p, __str.__get_long_cap()); __clear_and_shrink(); __alloc() = _VSTD::move(__a); __set_long_pointer(__p); @@ -1650,15 +1722,15 @@ } } - _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; @@ -1667,7 +1739,7 @@ #endif #endif - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void __move_assign_alloc(basic_string& __str) _NOEXCEPT_( @@ -1676,20 +1748,20 @@ {__move_assign_alloc(__str, integral_constant());} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void __move_assign_alloc(basic_string& __c, true_type) _NOEXCEPT_(is_nothrow_move_assignable::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) { @@ -1701,19 +1773,22 @@ 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 - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool __addr_in_range(_Tp&& __t) const { + if (__libcpp_is_constant_evaluated()) + return true; const volatile void *__p = _VSTD::addressof(__t); return data() <= __p && __p <= data() + size(); } @@ -1728,11 +1803,11 @@ _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 @@ -1779,7 +1854,7 @@ #endif template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::__invalidate_all_iterators() { @@ -1790,7 +1865,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type __pos) { @@ -1820,17 +1895,17 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>::basic_string() _NOEXCEPT_(is_nothrow_default_constructible::value) : __r_(__default_init_tag(), __default_init_tag()) { - _VSTD::__debug_db_insert_c(this); - __zero(); + std::__debug_db_insert_c(this); + __default_init(); } template -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::value) @@ -1839,15 +1914,18 @@ #endif : __r_(__default_init_tag(), __a) { - _VSTD::__debug_db_insert_c(this); - __zero(); + std::__debug_db_insert_c(this); + __default_init(); } template +_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; @@ -1859,9 +1937,10 @@ else { size_type __cap = __recommend(__reserve); - __p = __alloc_traits::allocate(__alloc(), __cap+1); + __p = __alloc_traits::allocate(__alloc(), __cap + 1); + __begin_lifetime(__p, __cap + 1); __set_long_pointer(__p); - __set_long_cap(__cap+1); + __set_long_cap(__cap + 1); __set_long_size(__sz); } traits_type::copy(_VSTD::__to_address(__p), __s, __sz); @@ -1869,9 +1948,12 @@ } template +_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; @@ -1883,9 +1965,10 @@ else { size_type __cap = __recommend(__sz); - __p = __alloc_traits::allocate(__alloc(), __cap+1); + __p = __alloc_traits::allocate(__alloc(), __cap + 1); + __begin_lifetime(__p, __cap + 1); __set_long_pointer(__p); - __set_long_cap(__cap+1); + __set_long_cap(__cap + 1); __set_long_size(__sz); } traits_type::copy(_VSTD::__to_address(__p), __s, __sz); @@ -1894,6 +1977,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a) : __r_(__default_init_tag(), __a) { @@ -1903,7 +1987,7 @@ } template -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()) { @@ -1913,7 +1997,7 @@ } template -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) { @@ -1923,6 +2007,7 @@ } template +_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())) { @@ -1935,6 +2020,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>::basic_string( const basic_string& __str, const allocator_type& __a) : __r_(__default_init_tag(), __a) @@ -1948,8 +2034,11 @@ } template +_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(); @@ -1959,17 +2048,18 @@ __throw_length_error(); size_t __cap = __recommend(__sz); __p = __alloc_traits::allocate(__alloc(), __cap + 1); + __begin_lifetime(__p, __cap + 1); __set_long_pointer(__p); __set_long_cap(__cap + 1); __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 -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::value) @@ -1987,7 +2077,7 @@ } template -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) { @@ -1995,7 +2085,9 @@ __init(_VSTD::__to_address(__str.__get_long_pointer()), __str.__get_long_size()); else { - __r_.first().__r = __str.__r_.first().__r; + if (__libcpp_is_constant_evaluated()) + __zero(); + __r_.first().__l = __str.__r_.first().__l; __str.__zero(); } _VSTD::__debug_db_insert_c(this); @@ -2008,9 +2100,12 @@ #endif // _LIBCPP_CXX03_LANG template +_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; @@ -2022,9 +2117,10 @@ else { size_type __cap = __recommend(__n); - __p = __alloc_traits::allocate(__alloc(), __cap+1); + __p = __alloc_traits::allocate(__alloc(), __cap + 1); + __begin_lifetime(__p, __cap + 1); __set_long_pointer(__p); - __set_long_cap(__cap+1); + __set_long_cap(__cap + 1); __set_long_size(__n); } traits_type::assign(_VSTD::__to_address(__p), __n, __c); @@ -2032,7 +2128,7 @@ } template -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()) { @@ -2042,6 +2138,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a) : __r_(__default_init_tag(), __a) { @@ -2050,6 +2147,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos, size_type __n, const _Allocator& __a) @@ -2063,7 +2161,7 @@ } template -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) @@ -2077,6 +2175,7 @@ template template +_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) @@ -2089,6 +2188,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t) : __r_(__default_init_tag(), __default_init_tag()) { @@ -2099,6 +2199,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _Allocator& __a) : __r_(__default_init_tag(), __a) { @@ -2109,13 +2210,14 @@ template template +_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 { @@ -2135,12 +2237,15 @@ template template +_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(_VSTD::distance(__first, __last)); if (__sz > max_size()) __throw_length_error(); @@ -2153,9 +2258,10 @@ else { size_type __cap = __recommend(__sz); - __p = __alloc_traits::allocate(__alloc(), __cap+1); + __p = __alloc_traits::allocate(__alloc(), __cap + 1); + __begin_lifetime(__p, __cap + 1); __set_long_pointer(__p); - __set_long_cap(__cap+1); + __set_long_cap(__cap + 1); __set_long_size(__sz); } @@ -2179,7 +2285,7 @@ template template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last) : __r_(__default_init_tag(), __default_init_tag()) { @@ -2189,7 +2295,7 @@ template template -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) @@ -2201,7 +2307,7 @@ #ifndef _LIBCPP_CXX03_LANG template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>::basic_string( initializer_list<_CharT> __il) : __r_(__default_init_tag(), __default_init_tag()) @@ -2211,8 +2317,7 @@ } template -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) @@ -2224,17 +2329,21 @@ #endif // _LIBCPP_CXX03_LANG template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>::~basic_string() { #if _LIBCPP_DEBUG_LEVEL == 2 if (!__libcpp_is_constant_evaluated()) __get_db()->__erase_c(this); #endif + if (__libcpp_is_constant_evaluated() && __get_long_pointer() == nullptr) + return; if (__is_long()) __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap()); } template +_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, @@ -2247,7 +2356,8 @@ size_type __cap = __old_cap < __ms / 2 - __alignment ? __recommend(_VSTD::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms - 1; - pointer __p = __alloc_traits::allocate(__alloc(), __cap+1); + pointer __p = __alloc_traits::allocate(__alloc(), __cap + 1); + __begin_lifetime(__p, __cap + 1); __invalidate_all_iterators(); if (__n_copy != 0) traits_type::copy(_VSTD::__to_address(__p), @@ -2258,7 +2368,7 @@ 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(__cap+1); @@ -2269,6 +2379,7 @@ template 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) { @@ -2280,6 +2391,7 @@ __recommend(_VSTD::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms - 1; pointer __p = __alloc_traits::allocate(__alloc(), __cap+1); + __begin_lifetime(__p, __cap + 1); __invalidate_all_iterators(); if (__n_copy != 0) traits_type::copy(_VSTD::__to_address(__p), @@ -2289,16 +2401,17 @@ 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(__cap+1); + __set_long_cap(__cap + 1); } // assign template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::__assign_no_alias( const value_type* __s, size_type __n) { @@ -2306,7 +2419,7 @@ 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 { @@ -2317,6 +2430,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::__assign_external( const value_type* __s, size_type __n) { @@ -2333,6 +2447,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n) { @@ -2343,6 +2458,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c) { @@ -2358,6 +2474,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c) { @@ -2379,6 +2496,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str) { @@ -2400,7 +2518,7 @@ #ifndef _LIBCPP_CXX03_LANG template -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) @@ -2412,7 +2530,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type) #if _LIBCPP_STD_VER > 14 @@ -2421,7 +2539,7 @@ _NOEXCEPT_(is_nothrow_move_assignable::value) #endif { - if (__is_long()) { + if (__is_long() && __get_long_pointer() != nullptr) { __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap()); #if _LIBCPP_STD_VER <= 14 @@ -2433,12 +2551,16 @@ } __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.__zero(); + } else { + __str.__set_short_size(0); + traits_type::assign(__str.__get_short_pointer()[0], value_type()); + } } template -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)) @@ -2452,6 +2574,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __is_exactly_cpp17_input_iterator<_InputIterator>::value, @@ -2466,6 +2589,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __is_cpp17_forward_iterator<_ForwardIterator>::value, @@ -2501,6 +2625,7 @@ } template +_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) { @@ -2512,6 +2637,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value @@ -2529,12 +2655,14 @@ template +_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 +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s) { @@ -2548,6 +2676,7 @@ // append template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __n) { @@ -2571,6 +2700,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c) { @@ -2590,7 +2720,7 @@ } template -inline void +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline void basic_string<_CharT, _Traits, _Allocator>::__append_default_init(size_type __n) { if (__n) @@ -2607,6 +2737,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c) { @@ -2628,7 +2759,7 @@ __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; @@ -2645,6 +2776,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __is_cpp17_forward_iterator<_ForwardIterator>::value, @@ -2679,7 +2811,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str) { @@ -2687,6 +2819,7 @@ } template +_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) { @@ -2698,6 +2831,7 @@ template template +_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, @@ -2713,6 +2847,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s) { @@ -2723,6 +2858,7 @@ // insert template +_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) { @@ -2731,6 +2867,13 @@ 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) @@ -2755,6 +2898,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n, value_type __c) { @@ -2787,6 +2931,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __is_exactly_cpp17_input_iterator<_InputIterator>::value, @@ -2803,6 +2948,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __is_cpp17_forward_iterator<_ForwardIterator>::value, @@ -2830,7 +2976,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_string& __str) { @@ -2838,6 +2984,7 @@ } template +_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) @@ -2850,6 +2997,7 @@ template template +_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, @@ -2866,6 +3014,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s) { @@ -2874,6 +3023,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename basic_string<_CharT, _Traits, _Allocator>::iterator basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_type __c) { @@ -2904,7 +3054,7 @@ } template -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) { @@ -2919,6 +3069,7 @@ // replace template +_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 @@ -2931,6 +3082,10 @@ 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) { @@ -2968,6 +3123,7 @@ } template +_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) { @@ -2998,6 +3154,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __is_cpp17_input_iterator<_InputIterator>::value, @@ -3011,7 +3168,7 @@ } template -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) { @@ -3019,6 +3176,7 @@ } template +_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) @@ -3031,6 +3189,7 @@ template template +_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, @@ -3047,6 +3206,7 @@ } template +_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) { @@ -3055,7 +3215,7 @@ } template -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) { @@ -3064,7 +3224,7 @@ } template -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) { @@ -3072,7 +3232,7 @@ } template -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) { @@ -3080,7 +3240,7 @@ } template -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) { @@ -3092,6 +3252,7 @@ // 'externally instantiated' erase() implementation, called when __n != npos. // Does not check __pos against size() template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move( size_type __pos, size_type __n) @@ -3109,6 +3270,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos, size_type __n) { @@ -3123,7 +3285,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 typename basic_string<_CharT, _Traits, _Allocator>::iterator basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos) { @@ -3139,7 +3301,7 @@ } template -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) { @@ -3155,7 +3317,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::pop_back() { @@ -3164,7 +3326,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::clear() _NOEXCEPT { @@ -3182,7 +3344,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::__erase_to_end(size_type __pos) { @@ -3190,6 +3352,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::resize(size_type __n, value_type __c) { @@ -3201,7 +3364,7 @@ } template -inline void +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline void basic_string<_CharT, _Traits, _Allocator>::__resize_default_init(size_type __n) { size_type __sz = size(); @@ -3212,7 +3375,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::max_size() const _NOEXCEPT { @@ -3225,6 +3388,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacity) { @@ -3245,7 +3409,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::shrink_to_fit() _NOEXCEPT { @@ -3256,7 +3420,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target_capacity) { @@ -3265,7 +3429,7 @@ pointer __new_data, __p; bool __was_long, __now_long; - if (__target_capacity == __min_cap - 1) + if (!__libcpp_is_constant_evaluated() && __target_capacity == __min_cap - 1) { __was_long = true; __now_long = false; @@ -3274,8 +3438,9 @@ } else { - if (__target_capacity > __cap) + if (__target_capacity > __cap) { __new_data = __alloc_traits::allocate(__alloc(), __target_capacity+1); + } else { #ifndef _LIBCPP_NO_EXCEPTIONS @@ -3294,6 +3459,7 @@ return; #endif // _LIBCPP_NO_EXCEPTIONS } + __begin_lifetime(__new_data, __target_capacity + 1); __now_long = true; __was_long = __is_long(); __p = __get_pointer(); @@ -3314,7 +3480,7 @@ } template -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 { @@ -3323,7 +3489,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 typename basic_string<_CharT, _Traits, _Allocator>::reference basic_string<_CharT, _Traits, _Allocator>::operator[](size_type __pos) _NOEXCEPT { @@ -3332,6 +3498,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename basic_string<_CharT, _Traits, _Allocator>::const_reference basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const { @@ -3341,6 +3508,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename basic_string<_CharT, _Traits, _Allocator>::reference basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) { @@ -3350,7 +3518,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 typename basic_string<_CharT, _Traits, _Allocator>::reference basic_string<_CharT, _Traits, _Allocator>::front() _NOEXCEPT { @@ -3359,7 +3527,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 typename basic_string<_CharT, _Traits, _Allocator>::const_reference basic_string<_CharT, _Traits, _Allocator>::front() const _NOEXCEPT { @@ -3368,7 +3536,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 typename basic_string<_CharT, _Traits, _Allocator>::reference basic_string<_CharT, _Traits, _Allocator>::back() _NOEXCEPT { @@ -3377,7 +3545,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 typename basic_string<_CharT, _Traits, _Allocator>::const_reference basic_string<_CharT, _Traits, _Allocator>::back() const _NOEXCEPT { @@ -3386,6 +3554,7 @@ } template +_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 { @@ -3398,7 +3567,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator> basic_string<_CharT, _Traits, _Allocator>::substr(size_type __pos, size_type __n) const { @@ -3406,7 +3575,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str) #if _LIBCPP_STD_VER >= 14 @@ -3445,6 +3614,7 @@ }; template +_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, @@ -3456,7 +3626,7 @@ } template -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 @@ -3467,6 +3637,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3481,7 +3652,7 @@ } template -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 @@ -3492,6 +3663,7 @@ } template +_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 @@ -3503,6 +3675,7 @@ // rfind template +_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, @@ -3514,7 +3687,7 @@ } template -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 @@ -3525,6 +3698,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3539,7 +3713,7 @@ } template -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 @@ -3550,6 +3724,7 @@ } template +_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 @@ -3561,6 +3736,7 @@ // find_first_of template +_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, @@ -3572,7 +3748,7 @@ } template -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 @@ -3583,6 +3759,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3597,7 +3774,7 @@ } template -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 @@ -3608,7 +3785,7 @@ } template -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 @@ -3619,6 +3796,7 @@ // find_last_of template +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, @@ -3630,7 +3808,7 @@ } template -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 @@ -3641,6 +3819,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3655,7 +3834,7 @@ } template -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 @@ -3666,7 +3845,7 @@ } template -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 @@ -3677,6 +3856,7 @@ // find_first_not_of template +_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, @@ -3688,7 +3868,7 @@ } template -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 @@ -3699,6 +3879,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3713,7 +3894,7 @@ } template -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 @@ -3724,7 +3905,7 @@ } template -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 @@ -3736,6 +3917,7 @@ // find_last_not_of template +_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, @@ -3747,7 +3929,7 @@ } template -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 @@ -3758,6 +3940,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3772,7 +3955,7 @@ } template -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 @@ -3783,7 +3966,7 @@ } template -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 @@ -3796,6 +3979,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3818,7 +4002,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 int basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const _NOEXCEPT { @@ -3826,6 +4010,7 @@ } template +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 int basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, @@ -3850,6 +4035,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3864,7 +4050,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 int basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, @@ -3875,6 +4061,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value @@ -3892,6 +4079,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 int basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, @@ -3903,6 +4091,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 int basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const _NOEXCEPT { @@ -3911,6 +4100,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 int basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, @@ -3923,10 +4113,12 @@ // __invariants template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 bool basic_string<_CharT, _Traits, _Allocator>::__invariants() const { + if (__libcpp_is_constant_evaluated()) + return true; if (size() > capacity()) return false; if (capacity() < __min_cap - 1) @@ -3941,7 +4133,7 @@ // __clear_and_shrink template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT { @@ -3958,7 +4150,7 @@ // operator== template -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 @@ -3970,7 +4162,7 @@ } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool operator==(const basic_string, _Allocator>& __lhs, const basic_string, _Allocator>& __rhs) _NOEXCEPT @@ -3989,7 +4181,7 @@ } template -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 @@ -4002,7 +4194,7 @@ } template -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 @@ -4015,7 +4207,7 @@ } template -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 @@ -4024,7 +4216,7 @@ } template -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 @@ -4033,7 +4225,7 @@ } template -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 @@ -4044,7 +4236,7 @@ // operator< template -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 @@ -4053,7 +4245,7 @@ } template -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 @@ -4062,7 +4254,7 @@ } template -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 @@ -4073,7 +4265,7 @@ // operator> template -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 @@ -4082,7 +4274,7 @@ } template -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 @@ -4091,7 +4283,7 @@ } template -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 @@ -4102,7 +4294,7 @@ // operator<= template -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 @@ -4111,7 +4303,7 @@ } template -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 @@ -4120,7 +4312,7 @@ } template -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 @@ -4131,7 +4323,7 @@ // operator>= template -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 @@ -4140,7 +4332,7 @@ } template -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 @@ -4149,7 +4341,7 @@ } template -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 @@ -4160,6 +4352,7 @@ // operator + template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator> operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) @@ -4168,12 +4361,14 @@ _String __r(_String::__alloc_traits::select_on_container_copy_construction(__lhs.get_allocator())); typename _String::size_type __lhs_sz = __lhs.size(); typename _String::size_type __rhs_sz = __rhs.size(); + __r.__deallocate_constexpr(); __r.__init(__lhs.data(), __lhs_sz, __lhs_sz + __rhs_sz); __r.append(__rhs.data(), __rhs_sz); return __r; } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator> operator+(const _CharT* __lhs , const basic_string<_CharT,_Traits,_Allocator>& __rhs) { @@ -4181,25 +4376,28 @@ _String __r(_String::__alloc_traits::select_on_container_copy_construction(__rhs.get_allocator())); typename _String::size_type __lhs_sz = _Traits::length(__lhs); typename _String::size_type __rhs_sz = __rhs.size(); + __r.__deallocate_constexpr(); __r.__init(__lhs, __lhs_sz, __lhs_sz + __rhs_sz); __r.append(__rhs.data(), __rhs_sz); return __r; } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator> operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { using _String = basic_string<_CharT, _Traits, _Allocator>; _String __r(_String::__alloc_traits::select_on_container_copy_construction(__rhs.get_allocator())); typename _String::size_type __rhs_sz = __rhs.size(); + __r.__deallocate_constexpr(); __r.__init(&__lhs, 1, 1 + __rhs_sz); __r.append(__rhs.data(), __rhs_sz); return __r; } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator> operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) { @@ -4207,18 +4405,21 @@ _String __r(_String::__alloc_traits::select_on_container_copy_construction(__lhs.get_allocator())); typename _String::size_type __lhs_sz = __lhs.size(); typename _String::size_type __rhs_sz = _Traits::length(__rhs); + __r.__deallocate_constexpr(); __r.__init(__lhs.data(), __lhs_sz, __lhs_sz + __rhs_sz); __r.append(__rhs, __rhs_sz); return __r; } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator> operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs) { using _String = basic_string<_CharT, _Traits, _Allocator>; _String __r(_String::__alloc_traits::select_on_container_copy_construction(__lhs.get_allocator())); typename _String::size_type __lhs_sz = __lhs.size(); + __r.__deallocate_constexpr(); __r.__init(__lhs.data(), __lhs_sz, __lhs_sz + 1); __r.push_back(__rhs); return __r; @@ -4227,7 +4428,7 @@ #ifndef _LIBCPP_CXX03_LANG template -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) { @@ -4235,7 +4436,7 @@ } template -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) { @@ -4243,7 +4444,7 @@ } template -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) { @@ -4251,7 +4452,7 @@ } template -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) { @@ -4259,7 +4460,7 @@ } template -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) { @@ -4268,7 +4469,7 @@ } template -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) { @@ -4276,7 +4477,7 @@ } template -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) { @@ -4289,7 +4490,7 @@ // swap template -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) @@ -4454,14 +4655,14 @@ { inline namespace string_literals { - inline _LIBCPP_INLINE_VISIBILITY + inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator "" s( const char *__str, size_t __len ) { return basic_string (__str, __len); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS - inline _LIBCPP_INLINE_VISIBILITY + inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator "" s( const wchar_t *__str, size_t __len ) { return basic_string (__str, __len); @@ -4469,20 +4670,20 @@ #endif #ifndef _LIBCPP_HAS_NO_CHAR8_T - inline _LIBCPP_INLINE_VISIBILITY + inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator "" s(const char8_t *__str, size_t __len) _NOEXCEPT { return basic_string (__str, __len); } #endif - inline _LIBCPP_INLINE_VISIBILITY + inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator "" s( const char16_t *__str, size_t __len ) { return basic_string (__str, __len); } - inline _LIBCPP_INLINE_VISIBILITY + inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator "" s( const char32_t *__str, size_t __len ) { return basic_string (__str, __len); diff --git a/libcxx/include/version b/libcxx/include/version --- a/libcxx/include/version +++ b/libcxx/include/version @@ -63,7 +63,7 @@ __cpp_lib_constexpr_iterator 201811L __cpp_lib_constexpr_memory 201811L __cpp_lib_constexpr_numeric 201911L -__cpp_lib_constexpr_string 201811L +__cpp_lib_constexpr_string 201907L __cpp_lib_constexpr_string_view 201811L __cpp_lib_constexpr_tuple 201811L __cpp_lib_constexpr_typeinfo 202106L @@ -314,7 +314,7 @@ # 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/std/language.support/support.limits/support.limits.general/string.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp --- a/libcxx/test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/string.version.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.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp --- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.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] @@ -2730,8 +2730,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 @@ -3980,8 +3980,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 --- a/libcxx/test/std/strings/basic.string/string.access/at.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.access/at.pass.cpp @@ -30,7 +30,7 @@ assert(cs.at(pos) == cs[pos]); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -54,7 +54,7 @@ #endif } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), 0); @@ -81,7 +81,7 @@ { 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 --- a/libcxx/test/std/strings/basic.string/string.access/back.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.access/back.pass.cpp @@ -32,7 +32,7 @@ assert(s.back() == typename S::value_type('z')); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S("1")); @@ -53,7 +53,7 @@ { 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 --- a/libcxx/test/std/strings/basic.string/string.access/front.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.access/front.pass.cpp @@ -32,7 +32,7 @@ assert(s.front() == typename S::value_type('z')); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S("1")); @@ -53,7 +53,7 @@ { 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 --- a/libcxx/test/std/strings/basic.string/string.access/index.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.access/index.pass.cpp @@ -17,7 +17,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 +62,7 @@ { 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 --- a/libcxx/test/std/strings/basic.string/string.capacity/capacity.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.capacity/capacity.pass.cpp @@ -18,11 +18,9 @@ #include "test_macros.h" -test_allocator_statistics alloc_stats; - template 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 @@ alloc_stats.throw_after = INT_MAX; } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { + test_allocator_statistics alloc_stats; typedef std::basic_string, test_allocator > S; S s((test_allocator(&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 @@ { 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 --- a/libcxx/test/std/strings/basic.string/string.capacity/clear.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.capacity/clear.pass.cpp @@ -24,7 +24,7 @@ assert(s.size() == 0); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; S s; @@ -61,7 +61,7 @@ { 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 --- a/libcxx/test/std/strings/basic.string/string.capacity/empty.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.capacity/empty.pass.cpp @@ -24,7 +24,7 @@ assert(s.empty() == (s.size() == 0)); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S()); @@ -47,7 +47,7 @@ { 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 --- a/libcxx/test/std/strings/basic.string/string.capacity/empty.verify.cpp +++ b/libcxx/test/std/strings/basic.string/string.capacity/empty.verify.cpp @@ -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 @@ { 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 --- a/libcxx/test/std/strings/basic.string/string.capacity/length.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.capacity/length.pass.cpp @@ -17,13 +17,13 @@ #include "min_allocator.h" template -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 +46,7 @@ { 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 --- 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 @@ -77,9 +77,6 @@ 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/over_max_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp --- 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 @@ -54,9 +54,6 @@ 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 --- 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 -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 @@ 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 --- 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 @@ -63,7 +63,7 @@ #endif } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; { @@ -106,7 +106,7 @@ { 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.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp --- 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 @@ -43,7 +43,7 @@ #endif } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), 0, S()); @@ -92,7 +92,7 @@ { 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 --- 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 @@ -43,7 +43,7 @@ #endif } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), 0, 'a', S()); @@ -92,7 +92,7 @@ { 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 --- 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 @@ -29,7 +29,7 @@ assert(s.capacity() >= s.size()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; S s; @@ -66,7 +66,7 @@ { 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 --- a/libcxx/test/std/strings/basic.string/string.capacity/size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.capacity/size.pass.cpp @@ -23,7 +23,7 @@ assert(s.size() == c); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), 0); @@ -46,7 +46,7 @@ { 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 --- 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 @@ -91,7 +91,7 @@ #endif } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef test_allocator A; typedef std::basic_string_view > SV; @@ -189,7 +189,7 @@ { 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 --- a/libcxx/test/std/strings/basic.string/string.cons/alloc.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.cons/alloc.pass.cpp @@ -85,7 +85,7 @@ #endif -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { test, test_allocator > >(); #if TEST_STD_VER >= 11 test2, min_allocator > >(); @@ -99,7 +99,7 @@ { 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 --- 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 @@ -18,7 +18,7 @@ #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 @@ { 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 --- 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 @@ -28,7 +28,7 @@ assert(s1.capacity() >= s1.size()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), 'a'); @@ -53,7 +53,7 @@ { 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 --- a/libcxx/test/std/strings/basic.string/string.cons/copy.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.cons/copy.pass.cpp @@ -28,7 +28,7 @@ assert(s2.get_allocator() == s1.get_allocator()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef test_allocator A; typedef std::basic_string, A> S; @@ -53,7 +53,7 @@ { 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 --- 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 @@ -88,7 +88,7 @@ assert(s2.get_allocator() == a); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef test_allocator A; typedef std::basic_string, A> S; @@ -135,7 +135,7 @@ { 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 --- 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 @@ -27,7 +27,7 @@ assert(s1.capacity() >= s1.size()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), S()); @@ -83,7 +83,7 @@ { 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 --- 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 @@ // (13) basic_string(initializer_list, 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::size_type; { // Testing (1) @@ -372,7 +372,7 @@ { 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 --- 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 @@ -19,7 +19,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 +52,7 @@ { 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 --- 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 @@ -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 @@ { 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 --- 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 @@ -62,7 +62,7 @@ assert(s2.capacity() >= s2.size()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef test_allocator A; const char* s = "12345678901234567890123456789012345678901234567890"; @@ -138,7 +138,7 @@ { 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 --- 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 @@ -33,7 +33,7 @@ #include "test_allocator.h" #include "min_allocator.h" -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { const char* s = "12345678901234"; std::basic_string s1(s, s+10); // Can't use {} here 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 --- a/libcxx/test/std/strings/basic.string/string.cons/move.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.cons/move.pass.cpp @@ -32,7 +32,7 @@ assert(s2.get_allocator() == s1.get_allocator()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef test_allocator A; typedef std::basic_string, A> S; @@ -55,7 +55,7 @@ { 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 --- 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 @@ -32,7 +32,7 @@ assert(s2.get_allocator() == a); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { test_allocator_statistics alloc_stats; { typedef test_allocator A; @@ -80,7 +80,7 @@ { 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 --- 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 @@ -62,7 +62,7 @@ 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::value, ""); @@ -100,7 +100,7 @@ { 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 --- 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 @@ -32,7 +32,7 @@ assert(s1.capacity() >= s1.size()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), S()); @@ -77,7 +77,7 @@ { 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_alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp --- 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 @@ -51,7 +51,7 @@ assert(s2.capacity() >= s2.size()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef test_allocator A; @@ -92,7 +92,7 @@ { 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 --- 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 @@ -29,7 +29,7 @@ assert(s1.capacity() >= s1.size()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), ""); @@ -76,7 +76,7 @@ { 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 --- 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 @@ -48,7 +48,7 @@ assert(s2.capacity() >= s2.size()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef test_allocator A; @@ -97,7 +97,7 @@ { 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 --- 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 @@ -50,7 +50,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(Tp n, Tp c) { typedef char charT; @@ -80,7 +80,7 @@ assert(s2.capacity() >= s2.size()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef test_allocator A; @@ -127,7 +127,7 @@ { 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 --- 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 @@ -71,7 +71,7 @@ } } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef test_allocator A; typedef std::basic_string_view > SV; @@ -114,7 +114,7 @@ { 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 --- 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 @@ -28,7 +28,7 @@ assert(s1.capacity() >= s1.size()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -77,7 +77,7 @@ { 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 --- 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 @@ -35,7 +35,7 @@ #include "test_allocator.h" #include "min_allocator.h" -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { std::string_view sv = "12345678901234"; std::basic_string s1(sv); @@ -109,7 +109,7 @@ { 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 --- 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 @@ -39,7 +39,7 @@ #include "test_allocator.h" #include "min_allocator.h" -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { std::string_view sv = "12345678901234"; std::basic_string s1{sv, 0, 4}; @@ -113,7 +113,7 @@ { 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 --- a/libcxx/test/std/strings/basic.string/string.cons/substr.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.cons/substr.pass.cpp @@ -138,7 +138,7 @@ #endif } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef test_allocator A; typedef std::basic_string, A> S; @@ -225,7 +225,7 @@ { 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 --- 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 @@ -16,7 +16,7 @@ #include "test_macros.h" -bool test() +TEST_CONSTEXPR_CXX20 bool test() { using S = std::string; @@ -39,7 +39,7 @@ { 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.contains/contains.ptr.pass.cpp b/libcxx/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp --- 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 @@ -16,7 +16,7 @@ #include "test_macros.h" -bool test() +TEST_CONSTEXPR_CXX20 bool test() { using S = std::string; @@ -69,7 +69,7 @@ { 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.contains/contains.string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp --- 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 @@ -16,7 +16,7 @@ #include "test_macros.h" -bool test() +TEST_CONSTEXPR_CXX20 bool test() { using S = std::string; using SV = std::string_view; @@ -90,7 +90,7 @@ { 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.ends_with/ends_with.char.pass.cpp b/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.char.pass.cpp --- 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 @@ -16,7 +16,7 @@ #include "test_macros.h" -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; S s1 {}; @@ -37,7 +37,7 @@ { 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.ends_with/ends_with.ptr.pass.cpp b/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.ptr.pass.cpp --- 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 @@ -16,7 +16,7 @@ #include "test_macros.h" -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; const char *s = "abcde"; @@ -65,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.ends_with/ends_with.string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.string_view.pass.cpp --- 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 @@ -16,7 +16,7 @@ #include "test_macros.h" -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -74,7 +74,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/begin.pass.cpp b/libcxx/test/std/strings/basic.string/string.iterators/begin.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.iterators/begin.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.iterators/begin.pass.cpp @@ -31,7 +31,7 @@ assert(b == cb); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S()); @@ -52,7 +52,7 @@ { 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 --- a/libcxx/test/std/strings/basic.string/string.iterators/cbegin.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.iterators/cbegin.pass.cpp @@ -28,7 +28,7 @@ assert(cb == s.begin()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S()); @@ -49,7 +49,7 @@ { 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 --- a/libcxx/test/std/strings/basic.string/string.iterators/cend.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.iterators/cend.pass.cpp @@ -24,7 +24,7 @@ assert(ce == s.end()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S()); @@ -45,7 +45,7 @@ { 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 --- a/libcxx/test/std/strings/basic.string/string.iterators/crbegin.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.iterators/crbegin.pass.cpp @@ -28,7 +28,7 @@ assert(cb == s.rbegin()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S()); @@ -49,7 +49,7 @@ { 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 --- a/libcxx/test/std/strings/basic.string/string.iterators/crend.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.iterators/crend.pass.cpp @@ -24,7 +24,7 @@ assert(ce == s.rend()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S()); @@ -45,7 +45,7 @@ { 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 --- a/libcxx/test/std/strings/basic.string/string.iterators/end.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.iterators/end.pass.cpp @@ -34,7 +34,7 @@ assert(static_cast(ce - cs.begin()) == cs.size()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S()); @@ -55,7 +55,7 @@ { 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/rbegin.pass.cpp b/libcxx/test/std/strings/basic.string/string.iterators/rbegin.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.iterators/rbegin.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.iterators/rbegin.pass.cpp @@ -31,7 +31,7 @@ assert(b == cb); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S()); @@ -52,7 +52,7 @@ { 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 --- a/libcxx/test/std/strings/basic.string/string.iterators/rend.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.iterators/rend.pass.cpp @@ -34,7 +34,7 @@ assert(static_cast(ce - cs.rbegin()) == cs.size()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S()); @@ -55,7 +55,7 @@ { 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 --- 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 @@ TEST_CONSTEXPR operator char() const { return ch_; } }; -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { std::string s; Charlike > a[] = {'m', 'a', 'h', 'i'}; s.append(a, a+4); @@ -39,7 +39,7 @@ { 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 --- 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 @@ -71,7 +71,7 @@ #endif } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -203,7 +203,7 @@ { 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 --- 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 @@ -18,7 +18,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 +38,7 @@ { 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 --- 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 @@ -52,7 +52,7 @@ } #endif -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -259,7 +259,7 @@ { 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 --- 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 @@ -26,7 +26,7 @@ assert(s == expected); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), "", S()); @@ -83,7 +83,7 @@ { 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 --- 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 @@ -27,7 +27,7 @@ assert(s == expected); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), "", 0, S()); @@ -92,7 +92,7 @@ { 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 --- 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 @@ -31,7 +31,7 @@ assert(s == expected); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), 'a', S(1, 'a')); @@ -63,7 +63,7 @@ { 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 --- 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 @@ -26,7 +26,7 @@ assert(s == expected); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), 0, 'a', S()); @@ -67,7 +67,7 @@ { 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 --- 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 @@ -26,7 +26,7 @@ assert(s == expected); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), S(), S()); @@ -92,7 +92,7 @@ { 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 --- 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 @@ -71,7 +71,7 @@ #endif } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), S(), 0, 0, S()); @@ -140,7 +140,7 @@ { 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 --- 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 @@ -27,7 +27,7 @@ assert(s == expected); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -86,7 +86,7 @@ { 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 --- 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 @@ -70,7 +70,7 @@ #endif } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -198,7 +198,7 @@ { 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 --- 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 @@ -18,7 +18,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 +38,7 @@ { 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 --- 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 @@ -52,7 +52,7 @@ } #endif -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -230,7 +230,7 @@ { 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 --- 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 @@ -26,7 +26,7 @@ assert(s == expected); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), "", S()); @@ -81,7 +81,7 @@ { 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 --- 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 @@ -27,7 +27,7 @@ assert(s == expected); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), "", 0, S()); @@ -92,7 +92,7 @@ { 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 --- 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 @@ -27,7 +27,7 @@ assert(s == expected); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), S(), S()); @@ -84,7 +84,7 @@ { 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 --- 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 @@ -26,7 +26,7 @@ assert(s == expected); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), 0, 'a', S()); @@ -67,7 +67,7 @@ { 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 --- 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 @@ -37,7 +37,7 @@ assert(s.get_allocator() == a); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), S(), S()); @@ -120,7 +120,7 @@ { 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 --- 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 @@ -30,7 +30,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -56,7 +56,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -71,7 +71,7 @@ #endif } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), S(), 0, 0, S()); @@ -140,7 +140,7 @@ { 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 --- 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 @@ -38,7 +38,7 @@ assert(s.get_allocator() == a); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -108,7 +108,7 @@ { 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 --- 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 @@ -19,7 +19,7 @@ #include "min_allocator.h" template -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 +33,7 @@ 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 +49,7 @@ #endif } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; char s[50]; @@ -184,7 +184,7 @@ { 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 --- 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 @@ -28,7 +28,7 @@ assert(i - s.begin() == pos); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S("abcde"), 0, S("bcde")); @@ -69,7 +69,7 @@ { 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 --- 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 @@ -29,7 +29,7 @@ assert(i - s.begin() == pos); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), 0, 0, S("")); @@ -154,7 +154,7 @@ { 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 --- 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 @@ -26,7 +26,7 @@ assert(s == expected); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S("abcde"), S("abcd")); @@ -49,7 +49,7 @@ { 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 --- 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 @@ -32,7 +32,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -62,7 +62,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -88,7 +88,7 @@ assert(s == expected); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), 0, 0, S("")); @@ -305,7 +305,7 @@ { 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 --- 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 @@ -32,7 +32,7 @@ assert(i == p); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; S s; @@ -79,7 +79,7 @@ { 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 --- 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 @@ -19,7 +19,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 +41,7 @@ { 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 --- 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 @@ -56,7 +56,7 @@ } #endif -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -150,7 +150,7 @@ } #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 TIter; typedef cpp17_input_iterator IIter; @@ -193,7 +193,7 @@ 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 +238,7 @@ { 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 --- 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 @@ -28,7 +28,7 @@ assert(s == expected); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), 0, 0, '1', S("")); @@ -173,7 +173,7 @@ { 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.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp --- 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 @@ -31,7 +31,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -47,7 +47,7 @@ #endif } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), 0, "", S("")); @@ -240,7 +240,7 @@ { 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 --- 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 @@ -32,7 +32,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -48,333 +48,9 @@ #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 +TEST_CONSTEXPR_CXX20 bool test() { { - typedef std::basic_string, min_allocator> S; test(S(""), 0, "", 0, S("")); test(S(""), 0, "12345", 0, S("")); test(S(""), 0, "12345", 1, S("1")); @@ -696,10 +372,8 @@ 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 +393,14 @@ int main(int, char**) { - test(); + test(); +#if TEST_STD_VER >= 11 + test, min_allocator>>(); +#endif + #if TEST_STD_VER > 17 - // static_assert(test()); + static_assert(test()); + static_assert(test, min_allocator>>()); #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 --- 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 @@ -32,7 +32,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -48,7 +48,7 @@ #endif } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), 0, 0, '1', S("")); @@ -225,7 +225,7 @@ { 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 --- 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 @@ -31,7 +31,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -47,7 +47,7 @@ #endif } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), 0, S(""), S("")); @@ -233,7 +233,7 @@ { 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/string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp --- 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 @@ -31,7 +31,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -47,7 +47,7 @@ #endif } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -242,7 +242,7 @@ { 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 --- 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 @@ -25,7 +25,7 @@ assert(s == expected); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), 'a', S("a")); @@ -50,7 +50,7 @@ { 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 --- 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 @@ -18,7 +18,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 +38,7 @@ { 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 --- 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 @@ -25,7 +25,7 @@ assert(s == expected); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), "", S()); @@ -82,7 +82,7 @@ { 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 --- 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 @@ -26,7 +26,7 @@ assert(s == expected); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(), S(), S()); @@ -92,7 +92,7 @@ { 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 --- 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 @@ -18,7 +18,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 +38,7 @@ { 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.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp --- 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 @@ -266,7 +266,7 @@ test(S("abcdefghijklmnopqrst"), 20, 0, "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -305,7 +305,7 @@ { 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_size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp --- 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 @@ -35,7 +35,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), 0, 0, 0, '3', S("")); test(S(""), 0, 0, 5, '3', S("33333")); @@ -140,7 +140,7 @@ } template -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 +245,7 @@ } template -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 +265,7 @@ test(S("abcdefghijklmnopqrst"), 20, 0, 20, '3', S("abcdefghijklmnopqrst33333333333333333333")); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -288,7 +288,7 @@ { 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 --- 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 @@ -34,7 +34,7 @@ } template -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 +136,12 @@ 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 -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 +243,12 @@ 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 -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 +266,22 @@ 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(); - test1(); - test2(); - } -#if TEST_STD_VER >= 11 +template +void test() { { - typedef std::basic_string, min_allocator> S; test0(); test1(); test2(); - } +#if TEST_STD_VER > 17 + static_assert(test0()); + static_assert(test1()); + static_assert(test2()); #endif + } #if TEST_STD_VER > 3 { // LWG 2946 @@ -288,15 +291,13 @@ assert(s == "a"); } #endif - - return true; } int main(int, char**) { - test(); -#if TEST_STD_VER > 17 - // static_assert(test()); + test(); +#if TEST_STD_VER >= 11 + test, min_allocator>>(); #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 --- 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 @@ -264,7 +264,7 @@ 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 +289,7 @@ { 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 --- 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 @@ -6017,7 +6017,7 @@ } template -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { test0(); test1(); test2(); 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 --- 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 @@ -36,7 +36,7 @@ assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -53,7 +53,7 @@ } template -TEST_CONSTEXPR_CXX20 void test0() +TEST_CONSTEXPR_CXX20 bool test0() { test(S(""), 0, 0, "", S("")); test(S(""), 0, 0, "12345", S("12345")); @@ -155,10 +155,12 @@ 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 -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 +262,12 @@ 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 -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 +365,29 @@ 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(); - test1(); - test2(); - } -#if TEST_STD_VER >= 11 +template +void test() { { - typedef std::basic_string, min_allocator> S; test0(); test1(); test2(); - } +#if TEST_STD_VER > 17 + static_assert(test0()); + static_assert(test1()); + static_assert(test2()); #endif - - return true; + } } int main(int, char**) { - test(); -#if TEST_STD_VER > 17 - // static_assert(test()); + test(); +#if TEST_STD_VER >= 11 + test, min_allocator>>(); #endif return 0; 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 --- 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 @@ -37,7 +37,7 @@ assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -54,7 +54,7 @@ } template -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 +156,12 @@ 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 -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 +263,12 @@ 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 -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 +366,28 @@ 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(); - test1(); - test2(); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - test0(); - test1(); - test2(); - } -#endif +template +void test() { + test0(); + test1(); + test2(); - return true; +#if TEST_STD_VER > 17 + static_assert(test0()); + static_assert(test1()); + static_assert(test2()); +#endif } int main(int, char**) { - test(); -#if TEST_STD_VER > 17 - // static_assert(test()); + test(); +#if TEST_STD_VER >= 11 + test, min_allocator>>(); #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 --- 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 @@ -35,7 +35,7 @@ assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -52,7 +52,7 @@ } template -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 +154,12 @@ 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 -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 +261,12 @@ 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 -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 +364,22 @@ 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(); - test1(); - test2(); - } -#if TEST_STD_VER >= 11 +template +void test() { { - typedef std::basic_string, min_allocator> S; test0(); test1(); test2(); - } +#if TEST_STD_VER > 17 + static_assert(test0()); + static_assert(test1()); + static_assert(test2()); #endif + } #if TEST_STD_VER > 3 { // LWG 2946 @@ -386,16 +389,13 @@ assert(s == "a"); } #endif - - return true; } int main(int, char**) { - test(); -#if TEST_STD_VER > 17 - // static_assert(test()); + test(); +#if TEST_STD_VER >= 11 + test, min_allocator>>(); #endif - return 0; } 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 --- 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 @@ -35,7 +35,7 @@ assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -52,7 +52,7 @@ } template -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 +154,12 @@ 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 -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 +261,12 @@ 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 -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 +364,30 @@ 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() { - { - typedef std::string S; - typedef std::string_view SV; - test0(); - test1(); - test2(); - } -#if TEST_STD_VER >= 11 +template +void test() { { - typedef std::basic_string, min_allocator> S; typedef std::string_view SV; test0(); test1(); test2(); - } +#if TEST_STD_VER > 17 + static_assert(test0()); + static_assert(test1()); + static_assert(test2()); #endif - - return true; + } } int main(int, char**) { - test(); -#if TEST_STD_VER > 17 - // static_assert(test()); + test(); +#if TEST_STD_VER >= 11 + test, min_allocator>>(); #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 --- 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 @@ -31,7 +31,7 @@ assert(s2 == s1_); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), S("")); @@ -80,7 +80,7 @@ { 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 --- 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 @@ -33,7 +33,7 @@ assert(s2 == s1_); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), S("")); @@ -82,7 +82,7 @@ { 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 --- 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 @@ -24,7 +24,7 @@ assert((lhs != rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test("", S(""), false); @@ -73,7 +73,7 @@ { 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 --- 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 @@ -24,7 +24,7 @@ assert((lhs != rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), "", false); @@ -73,7 +73,7 @@ { 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 --- 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 @@ -25,7 +25,7 @@ assert((lhs != rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), S(""), false); @@ -74,7 +74,7 @@ { 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 --- 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 @@ -23,7 +23,7 @@ assert((lhs != rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string SV; @@ -74,7 +74,7 @@ { 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 --- 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 @@ -23,7 +23,7 @@ assert((lhs != rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -74,7 +74,7 @@ { 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 --- 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 @@ }; template -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { using S = std::basic_string, soccc_allocator>; { int soccc_lhs = 0; 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 --- 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 @@ -35,7 +35,7 @@ } #endif -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0('a', S(""), S("a")); @@ -73,7 +73,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+/pointer_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp --- 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 @@ -35,7 +35,7 @@ } #endif -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0("", S(""), S("")); @@ -134,7 +134,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_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp --- 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 @@ -35,7 +35,7 @@ } #endif -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(S(""), '1', S("1")); @@ -73,7 +73,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 --- 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 @@ -35,7 +35,7 @@ } #endif -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(S(""), "", S("")); @@ -133,7 +133,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 --- 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 @@ -57,7 +57,7 @@ } #endif -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(S(""), S(""), S("")); @@ -251,7 +251,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==/pointer_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_operator==/pointer_string.pass.cpp --- 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 @@ -24,7 +24,7 @@ assert((lhs == rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test("", S(""), true); @@ -73,7 +73,7 @@ { 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 --- 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 @@ -24,7 +24,7 @@ assert((lhs == rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), "", true); @@ -73,7 +73,7 @@ { 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 --- 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 @@ -25,7 +25,7 @@ assert((lhs == rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), S(""), true); @@ -74,7 +74,7 @@ { 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 --- 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 @@ -23,7 +23,7 @@ assert((lhs == rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -74,7 +74,7 @@ { 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 --- 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 @@ -23,7 +23,7 @@ assert((lhs == rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -74,7 +74,7 @@ { 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 --- 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 @@ -24,7 +24,7 @@ assert((lhs > rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test("", S(""), false); @@ -73,7 +73,7 @@ { 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 --- 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 @@ -24,7 +24,7 @@ assert((lhs > rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), "", false); @@ -73,7 +73,7 @@ { 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 --- 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 @@ -25,7 +25,7 @@ assert((lhs > rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), S(""), false); @@ -74,7 +74,7 @@ { 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 --- 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 @@ -23,7 +23,7 @@ assert((lhs > rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -74,7 +74,7 @@ { 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 --- 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 @@ -23,7 +23,7 @@ assert((lhs > rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -74,7 +74,7 @@ { 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 --- 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 @@ -24,7 +24,7 @@ assert((lhs >= rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test("", S(""), true); @@ -73,7 +73,7 @@ { 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 --- 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 @@ -24,7 +24,7 @@ assert((lhs >= rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), "", true); @@ -73,7 +73,7 @@ { 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 --- 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 @@ -25,7 +25,7 @@ assert((lhs >= rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), S(""), true); @@ -74,7 +74,7 @@ { 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 --- 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 @@ -23,7 +23,7 @@ assert((lhs >= rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -74,7 +74,7 @@ { 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 --- 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 @@ -23,7 +23,7 @@ assert((lhs >= rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -74,7 +74,7 @@ { 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 --- 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 @@ -24,7 +24,7 @@ assert((lhs < rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test("", S(""), false); @@ -73,7 +73,7 @@ { 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 --- 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 @@ -24,7 +24,7 @@ assert((lhs < rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), "", false); @@ -73,7 +73,7 @@ { 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 --- 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 @@ -25,7 +25,7 @@ assert((lhs < rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), S(""), false); @@ -74,7 +74,7 @@ { 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 --- 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 @@ -23,7 +23,7 @@ assert((lhs < rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -74,7 +74,7 @@ { 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 --- 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 @@ -23,7 +23,7 @@ assert((lhs < rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -74,7 +74,7 @@ { 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 --- 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 @@ -24,7 +24,7 @@ assert((lhs <= rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test("", S(""), true); @@ -73,7 +73,7 @@ { 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 --- 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 @@ -24,7 +24,7 @@ assert((lhs <= rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), "", true); @@ -73,7 +73,7 @@ { 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 --- 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 @@ -25,7 +25,7 @@ assert((lhs <= rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), S(""), true); @@ -74,7 +74,7 @@ { 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 --- 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 @@ -23,7 +23,7 @@ assert((lhs <= rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -74,7 +74,7 @@ { 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 --- 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 @@ -23,7 +23,7 @@ assert((lhs <= rhs) == x); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -74,7 +74,7 @@ { 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 --- 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 @@ -31,7 +31,7 @@ assert(T::eq(str[0], typename S::value_type())); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S("")); @@ -56,7 +56,7 @@ { 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 --- 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 @@ -47,7 +47,7 @@ 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 +81,7 @@ { 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 --- 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 @@ -24,7 +24,7 @@ assert(s.get_allocator() == a); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef test_allocator A; typedef std::basic_string, A> S; @@ -51,7 +51,7 @@ { 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 --- 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 @@ -33,7 +33,7 @@ assert(sign(s.compare(str)) == sign(x)); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), "", 0); @@ -82,7 +82,7 @@ { 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.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp --- 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 @@ -35,7 +35,7 @@ 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 +51,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), 0, 0, "", 0); test(S(""), 0, 0, "abcde", -5); @@ -156,7 +156,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S("abcde"), 6, 0, "", 0); test(S("abcde"), 6, 0, "abcde", 0); @@ -261,7 +261,7 @@ } template -void test2() +TEST_CONSTEXPR_CXX20 void test2() { test(S("abcdefghijklmnopqrst"), 0, 0, "", 0); test(S("abcdefghijklmnopqrst"), 0, 0, "abcde", -5); @@ -361,7 +361,7 @@ test(S("abcdefghijklmnopqrst"), 21, 0, "abcdefghijklmnopqrst", 0); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -384,7 +384,7 @@ { 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.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp --- 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 @@ -17,7 +17,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 +27,14 @@ } template -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 +50,7 @@ } template -void test0() +TEST_CONSTEXPR_CXX20 void test0() { test(S(""), 0, 0, S(""), 0); test(S(""), 0, 0, S("abcde"), -5); @@ -155,7 +155,7 @@ } template -void test1() +TEST_CONSTEXPR_CXX20 void test1() { test(S("abcde"), 6, 0, S(""), 0); test(S("abcde"), 6, 0, S("abcde"), 0); @@ -260,7 +260,7 @@ } template -void test2() +TEST_CONSTEXPR_CXX20 void test2() { test(S("abcdefghijklmnopqrst"), 0, 0, S(""), 0); test(S("abcdefghijklmnopqrst"), 0, 0, S("abcde"), -5); @@ -360,7 +360,7 @@ test(S("abcdefghijklmnopqrst"), 21, 0, S("abcdefghijklmnopqrst"), 0); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -390,7 +390,7 @@ { 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_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp --- 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 @@ -35,7 +35,7 @@ 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 +361,7 @@ 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 +386,7 @@ { 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 --- 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 @@ -33,7 +33,7 @@ assert(sign(s.compare(str)) == sign(x)); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), S(""), 0); @@ -89,7 +89,7 @@ { 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 --- 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 @@ -33,7 +33,7 @@ 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 +84,7 @@ { 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 --- 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 @@ -37,7 +37,7 @@ assert(x < s.size()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), 'q', 0, S::npos); @@ -108,7 +108,7 @@ { 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 --- 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 @@ -142,7 +142,7 @@ test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", S::npos); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -163,7 +163,7 @@ { 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 --- 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 @@ -367,7 +367,7 @@ test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, S::npos); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -392,7 +392,7 @@ { 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 --- 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 @@ -142,7 +142,7 @@ test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), S::npos); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -170,7 +170,7 @@ { 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 --- 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 @@ -142,7 +142,7 @@ 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 +165,7 @@ { 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 --- 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 @@ -37,7 +37,7 @@ assert(x < s.size()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), 'e', 0, S::npos); @@ -104,7 +104,7 @@ { 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 --- 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 @@ -143,7 +143,7 @@ test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", 0); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -164,7 +164,7 @@ { 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 --- 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 @@ -367,7 +367,7 @@ test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, S::npos); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -392,7 +392,7 @@ { 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 --- 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 @@ -142,7 +142,7 @@ test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), 0); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -170,7 +170,7 @@ { 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 --- 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 @@ -142,7 +142,7 @@ test(S("pniotcfrhqsmgdkjbael"), SV("htaobedqikfplcgjsmrn"), 0); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -165,7 +165,7 @@ { 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 --- 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 @@ -37,7 +37,7 @@ assert(x < s.size()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), 'i', 0, S::npos); @@ -104,7 +104,7 @@ { 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 --- 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 @@ -143,7 +143,7 @@ test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", S::npos); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -164,7 +164,7 @@ { 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 --- 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 @@ -367,7 +367,7 @@ test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, S::npos); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -392,7 +392,7 @@ { 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 --- 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 @@ -142,7 +142,7 @@ test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), S::npos); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -170,7 +170,7 @@ { 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 --- 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 @@ -142,7 +142,7 @@ 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 +165,7 @@ { 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 --- 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 @@ -37,7 +37,7 @@ assert(x < s.size()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), 'm', 0, S::npos); @@ -104,7 +104,7 @@ { 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 --- 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 @@ -143,7 +143,7 @@ test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", 19); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -164,7 +164,7 @@ { 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 --- 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 @@ -367,7 +367,7 @@ test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, 19); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -392,7 +392,7 @@ { 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 --- 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 @@ -142,7 +142,7 @@ test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), 19); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -170,7 +170,7 @@ { 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 --- 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 @@ -142,7 +142,7 @@ test(S("pniotcfrhqsmgdkjbael"), SV("htaobedqikfplcgjsmrn"), 19); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -165,7 +165,7 @@ { 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 --- 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 @@ -37,7 +37,7 @@ 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 +104,7 @@ { 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 --- 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 @@ -149,7 +149,7 @@ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -170,7 +170,7 @@ { 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 --- 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 @@ -17,7 +17,7 @@ #include "min_allocator.h" template -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 +367,7 @@ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 20, S::npos); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -392,7 +392,7 @@ { 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 --- 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 @@ -142,7 +142,7 @@ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 0); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -170,7 +170,7 @@ { 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 --- 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 @@ -142,7 +142,7 @@ test(S("abcdeabcdeabcdeabcde"), SV("abcdeabcdeabcdeabcde"), 0); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -165,7 +165,7 @@ { 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 --- 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 @@ -37,7 +37,7 @@ assert(x + 1 <= s.size()); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), 'b', 0, S::npos); @@ -104,7 +104,7 @@ { 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 --- 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 @@ -150,7 +150,7 @@ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -171,7 +171,7 @@ { 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 --- 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 @@ -367,7 +367,7 @@ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 20, 0); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -392,7 +392,7 @@ { 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 --- 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 @@ -142,7 +142,7 @@ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 0); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test0(); @@ -170,7 +170,7 @@ { 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 --- 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 @@ -142,7 +142,7 @@ test(S("abcdeabcdeabcdeabcde"), SV("abcdeabcdeabcdeabcde"), 0); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; typedef std::string_view SV; @@ -165,7 +165,7 @@ { 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 --- 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 @@ -32,7 +32,7 @@ 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 +47,7 @@ #endif } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test(S(""), 0, 0); @@ -180,7 +180,7 @@ { 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 --- a/libcxx/test/std/strings/basic.string/string.require/contiguous.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.require/contiguous.pass.cpp @@ -19,13 +19,13 @@ template -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(i)) == *(std::addressof(*c.begin()) + i)); } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; test_contiguous(S()); @@ -57,7 +57,7 @@ { 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 --- 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 @@ -16,7 +16,7 @@ #include "test_macros.h" -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; S s1 {}; @@ -37,7 +37,7 @@ { 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.ptr.pass.cpp b/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.ptr.pass.cpp --- 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 @@ -16,7 +16,7 @@ #include "test_macros.h" -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; const char *s = "abcde"; @@ -65,7 +65,7 @@ { 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.string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.string_view.pass.cpp --- 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 @@ -16,7 +16,7 @@ #include "test_macros.h" -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { typedef std::string S; typedef std::string_view SV; const char *s = "abcde"; @@ -73,7 +73,7 @@ { test(); #if TEST_STD_VER > 17 - // static_assert(test()); + static_assert(test()); #endif return 0; diff --git a/libcxx/test/support/constexpr_char_traits.h b/libcxx/test/support/constexpr_char_traits.h --- a/libcxx/test/support/constexpr_char_traits.h +++ b/libcxx/test/support/constexpr_char_traits.h @@ -118,7 +118,8 @@ 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) + 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 --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -249,7 +249,7 @@ "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",