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 @@ -95,248 +95,246 @@ static const size_type npos = -1; basic_string() - noexcept(is_nothrow_default_constructible::value); - explicit basic_string(const allocator_type& a); - basic_string(const basic_string& str); + noexcept(is_nothrow_default_constructible::value); // constexpr since C++20 + explicit basic_string(const allocator_type& a); // constexpr since C++20 + basic_string(const basic_string& str); // constexpr since C++20 basic_string(basic_string&& str) - noexcept(is_nothrow_move_constructible::value); + noexcept(is_nothrow_move_constructible::value); // constexpr since C++20 basic_string(const basic_string& str, size_type pos, - const allocator_type& a = allocator_type()); + const allocator_type& a = allocator_type()); // constexpr since C++20 basic_string(const basic_string& str, size_type pos, size_type n, - const Allocator& a = Allocator()); + const Allocator& a = Allocator()); // constexpr since C++20 template - basic_string(const T& t, size_type pos, size_type n, const Allocator& a = Allocator()); // C++17 + basic_string(const T& t, size_type pos, size_type n, const Allocator& a = Allocator()); // C++17, constexpr since C++20 template - explicit basic_string(const T& t, const Allocator& a = Allocator()); // C++17 - basic_string(const value_type* s, const allocator_type& a = allocator_type()); - basic_string(const value_type* s, size_type n, const allocator_type& a = allocator_type()); + explicit basic_string(const T& t, const Allocator& a = Allocator()); // C++17, constexpr since C++20 + basic_string(const value_type* s, const allocator_type& a = allocator_type()); // constexpr since C++20 + basic_string(const value_type* s, size_type n, const allocator_type& a = allocator_type()); // constexpr since C++20 basic_string(nullptr_t) = delete; // C++2b - basic_string(size_type n, value_type c, const allocator_type& a = allocator_type()); + basic_string(size_type n, value_type c, const allocator_type& a = allocator_type()); // constexpr since C++20 template basic_string(InputIterator begin, InputIterator end, - const allocator_type& a = allocator_type()); - basic_string(initializer_list, const Allocator& = Allocator()); - basic_string(const basic_string&, const Allocator&); - basic_string(basic_string&&, const Allocator&); + const allocator_type& a = allocator_type()); // constexpr since C++20 + basic_string(initializer_list, const Allocator& = Allocator()); // constexpr since C++20 + basic_string(const basic_string&, const Allocator&); // constexpr since C++20 + basic_string(basic_string&&, const Allocator&); // constexpr since C++20 - ~basic_string(); + ~basic_string(); // constexpr since C++20 - operator basic_string_view() const noexcept; + operator basic_string_view() const noexcept; // constexpr since C++20 - basic_string& operator=(const basic_string& str); + basic_string& operator=(const basic_string& str); // constexpr since C++20 template - basic_string& operator=(const T& t); // C++17 + basic_string& operator=(const T& t); // C++17, constexpr since C++20 basic_string& operator=(basic_string&& str) noexcept( allocator_type::propagate_on_container_move_assignment::value || - allocator_type::is_always_equal::value ); // C++17 - basic_string& operator=(const value_type* s); + allocator_type::is_always_equal::value ); // C++17, constexpr since C++20 + basic_string& operator=(const value_type* s); // constexpr since C++20 basic_string& operator=(nullptr_t) = delete; // C++2b - basic_string& operator=(value_type c); - basic_string& operator=(initializer_list); + basic_string& operator=(value_type c); // constexpr since C++20 + basic_string& operator=(initializer_list); // constexpr since C++20 - iterator begin() noexcept; - const_iterator begin() const noexcept; - iterator end() noexcept; - const_iterator end() const noexcept; + iterator begin() noexcept; // constexpr since C++20 + const_iterator begin() const noexcept; // constexpr since C++20 + iterator end() noexcept; // constexpr since C++20 + const_iterator end() const noexcept; // constexpr since C++20 - reverse_iterator rbegin() noexcept; - const_reverse_iterator rbegin() const noexcept; - reverse_iterator rend() noexcept; - const_reverse_iterator rend() const noexcept; + reverse_iterator rbegin() noexcept; // constexpr since C++20 + const_reverse_iterator rbegin() const noexcept; // constexpr since C++20 + reverse_iterator rend() noexcept; // constexpr since C++20 + const_reverse_iterator rend() const noexcept; // constexpr since C++20 - const_iterator cbegin() const noexcept; - const_iterator cend() const noexcept; - const_reverse_iterator crbegin() const noexcept; - const_reverse_iterator crend() const noexcept; + const_iterator cbegin() const noexcept; // constexpr since C++20 + const_iterator cend() const noexcept; // constexpr since C++20 + const_reverse_iterator crbegin() const noexcept; // constexpr since C++20 + const_reverse_iterator crend() const noexcept; // constexpr since C++20 - size_type size() const noexcept; - size_type length() const noexcept; - size_type max_size() const noexcept; - size_type capacity() const noexcept; + size_type size() const noexcept; // constexpr since C++20 + size_type length() const noexcept; // constexpr since C++20 + size_type max_size() const noexcept; // constexpr since C++20 + size_type capacity() const noexcept; // constexpr since C++20 - void resize(size_type n, value_type c); - void resize(size_type n); + void resize(size_type n, value_type c); // constexpr since C++20 + void resize(size_type n); // constexpr since C++20 template constexpr void resize_and_overwrite(size_type n, Operation op); // since C++23 - void reserve(size_type res_arg); + void reserve(size_type res_arg); // constexpr since C++20 void reserve(); // deprecated in C++20 - void shrink_to_fit(); - void clear() noexcept; - bool empty() const noexcept; + void shrink_to_fit(); // constexpr since C++20 + void clear() noexcept; // constexpr since C++20 + bool empty() const noexcept; // constexpr since C++20 - const_reference operator[](size_type pos) const; - reference operator[](size_type pos); + const_reference operator[](size_type pos) const; // constexpr since C++20 + reference operator[](size_type pos); // constexpr since C++20 - const_reference at(size_type n) const; - reference at(size_type n); + const_reference at(size_type n) const; // constexpr since C++20 + reference at(size_type n); // constexpr since C++20 - basic_string& operator+=(const basic_string& str); + basic_string& operator+=(const basic_string& str); // constexpr since C++20 template - basic_string& operator+=(const T& t); // C++17 - basic_string& operator+=(const value_type* s); - basic_string& operator+=(value_type c); - basic_string& operator+=(initializer_list); + basic_string& operator+=(const T& t); // C++17, constexpr since C++20 + basic_string& operator+=(const value_type* s); // constexpr since C++20 + basic_string& operator+=(value_type c); // constexpr since C++20 + basic_string& operator+=(initializer_list); // constexpr since C++20 - basic_string& append(const basic_string& str); + basic_string& append(const basic_string& str); // constexpr since C++20 template - basic_string& append(const T& t); // C++17 - basic_string& append(const basic_string& str, size_type pos, size_type n=npos); //C++14 + basic_string& append(const T& t); // C++17, constexpr since C++20 + basic_string& append(const basic_string& str, size_type pos, size_type n=npos); // C++14, constexpr since C++20 template - basic_string& append(const T& t, size_type pos, size_type n=npos); // C++17 - basic_string& append(const value_type* s, size_type n); - basic_string& append(const value_type* s); - basic_string& append(size_type n, value_type c); + basic_string& append(const T& t, size_type pos, size_type n=npos); // C++17, constexpr since C++20 + basic_string& append(const value_type* s, size_type n); // constexpr since C++20 + basic_string& append(const value_type* s); // constexpr since C++20 + basic_string& append(size_type n, value_type c); // constexpr since C++20 template - basic_string& append(InputIterator first, InputIterator last); - basic_string& append(initializer_list); + basic_string& append(InputIterator first, InputIterator last); // constexpr since C++20 + basic_string& append(initializer_list); // constexpr since C++20 - void push_back(value_type c); - void pop_back(); - reference front(); - const_reference front() const; - reference back(); - const_reference back() const; + void push_back(value_type c); // constexpr since C++20 + void pop_back(); // constexpr since C++20 + reference front(); // constexpr since C++20 + const_reference front() const; // constexpr since C++20 + reference back(); // constexpr since C++20 + const_reference back() const; // constexpr since C++20 - basic_string& assign(const basic_string& str); + basic_string& assign(const basic_string& str); // constexpr since C++20 template - basic_string& assign(const T& t); // C++17 - basic_string& assign(basic_string&& str); - basic_string& assign(const basic_string& str, size_type pos, size_type n=npos); // C++14 + basic_string& assign(const T& t); // C++17, constexpr since C++20 + basic_string& assign(basic_string&& str); // constexpr since C++20 + basic_string& assign(const basic_string& str, size_type pos, size_type n=npos); // C++14, constexpr since C++20 template - basic_string& assign(const T& t, size_type pos, size_type n=npos); // C++17 - basic_string& assign(const value_type* s, size_type n); - basic_string& assign(const value_type* s); - basic_string& assign(size_type n, value_type c); + basic_string& assign(const T& t, size_type pos, size_type n=npos); // C++17, constexpr since C++20 + basic_string& assign(const value_type* s, size_type n); // constexpr since C++20 + basic_string& assign(const value_type* s); // constexpr since C++20 + basic_string& assign(size_type n, value_type c); // constexpr since C++20 template - basic_string& assign(InputIterator first, InputIterator last); - basic_string& assign(initializer_list); + basic_string& assign(InputIterator first, InputIterator last); // constexpr since C++20 + basic_string& assign(initializer_list); // constexpr since C++20 - basic_string& insert(size_type pos1, const basic_string& str); + basic_string& insert(size_type pos1, const basic_string& str); // constexpr since C++20 template - basic_string& insert(size_type pos1, const T& t); + basic_string& insert(size_type pos1, const T& t); // constexpr since C++20 basic_string& insert(size_type pos1, const basic_string& str, - size_type pos2, size_type n); + size_type pos2, size_type n); // constexpr since C++20 template - basic_string& insert(size_type pos1, const T& t, size_type pos2, size_type n); // C++17 - basic_string& insert(size_type pos, const value_type* s, size_type n=npos); //C++14 - basic_string& insert(size_type pos, const value_type* s); - basic_string& insert(size_type pos, size_type n, value_type c); - iterator insert(const_iterator p, value_type c); - iterator insert(const_iterator p, size_type n, value_type c); + basic_string& insert(size_type pos1, const T& t, size_type pos2, size_type n); // C++17, constexpr since C++20 + basic_string& insert(size_type pos, const value_type* s, size_type n=npos); // C++14, constexpr since C++20 + basic_string& insert(size_type pos, const value_type* s); // constexpr since C++20 + basic_string& insert(size_type pos, size_type n, value_type c); // constexpr since C++20 + iterator insert(const_iterator p, value_type c); // constexpr since C++20 + iterator insert(const_iterator p, size_type n, value_type c); // constexpr since C++20 template - iterator insert(const_iterator p, InputIterator first, InputIterator last); - iterator insert(const_iterator p, initializer_list); + iterator insert(const_iterator p, InputIterator first, InputIterator last); // constexpr since C++20 + iterator insert(const_iterator p, initializer_list); // constexpr since C++20 - basic_string& erase(size_type pos = 0, size_type n = npos); - iterator erase(const_iterator position); - iterator erase(const_iterator first, const_iterator last); + basic_string& erase(size_type pos = 0, size_type n = npos); // constexpr since C++20 + iterator erase(const_iterator position); // constexpr since C++20 + iterator erase(const_iterator first, const_iterator last); // constexpr since C++20 - basic_string& replace(size_type pos1, size_type n1, const basic_string& str); + basic_string& replace(size_type pos1, size_type n1, const basic_string& str); // constexpr since C++20 template - basic_string& replace(size_type pos1, size_type n1, const T& t); // C++17 + basic_string& replace(size_type pos1, size_type n1, const T& t); // C++17, constexpr since C++20 basic_string& replace(size_type pos1, size_type n1, const basic_string& str, - size_type pos2, size_type n2=npos); // C++14 + size_type pos2, size_type n2=npos); // C++14, constexpr since C++20 template basic_string& replace(size_type pos1, size_type n1, const T& t, - size_type pos2, size_type n); // C++17 - basic_string& replace(size_type pos, size_type n1, const value_type* s, size_type n2); - basic_string& replace(size_type pos, size_type n1, const value_type* s); - basic_string& replace(size_type pos, size_type n1, size_type n2, value_type c); - basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str); + size_type pos2, size_type n); // C++17, constexpr since C++20 + basic_string& replace(size_type pos, size_type n1, const value_type* s, size_type n2); // constexpr since C++20 + basic_string& replace(size_type pos, size_type n1, const value_type* s); // constexpr since C++20 + basic_string& replace(size_type pos, size_type n1, size_type n2, value_type c); // constexpr since C++20 + basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str); // constexpr since C++20 template - basic_string& replace(const_iterator i1, const_iterator i2, const T& t); // C++17 - basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s, size_type n); - basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s); - basic_string& replace(const_iterator i1, const_iterator i2, size_type n, value_type c); + basic_string& replace(const_iterator i1, const_iterator i2, const T& t); // C++17, constexpr since C++20 + basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s, size_type n); // constexpr since C++20 + basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s); // constexpr since C++20 + basic_string& replace(const_iterator i1, const_iterator i2, size_type n, value_type c); // constexpr since C++20 template - basic_string& replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2); - basic_string& replace(const_iterator i1, const_iterator i2, initializer_list); + basic_string& replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2); // constexpr since C++20 + basic_string& replace(const_iterator i1, const_iterator i2, initializer_list); // constexpr since C++20 - size_type copy(value_type* s, size_type n, size_type pos = 0) const; - basic_string substr(size_type pos = 0, size_type n = npos) const; + size_type copy(value_type* s, size_type n, size_type pos = 0) const; // constexpr since C++20 + basic_string substr(size_type pos = 0, size_type n = npos) const; // constexpr since C++20 void swap(basic_string& str) noexcept(allocator_traits::propagate_on_container_swap::value || - allocator_traits::is_always_equal::value); // C++17 + allocator_traits::is_always_equal::value); // C++17, constexpr since C++20 - const value_type* c_str() const noexcept; - const value_type* data() const noexcept; - value_type* data() noexcept; // C++17 + const value_type* c_str() const noexcept; // constexpr since C++20 + const value_type* data() const noexcept; // constexpr since C++20 + value_type* data() noexcept; // C++17, constexpr since C++20 - allocator_type get_allocator() const noexcept; + allocator_type get_allocator() const noexcept; // constexpr since C++20 - size_type find(const basic_string& str, size_type pos = 0) const noexcept; + size_type find(const basic_string& str, size_type pos = 0) const noexcept; // constexpr since C++20 template - size_type find(const T& t, size_type pos = 0) const noexcept; // C++17, noexcept as an extension - size_type find(const value_type* s, size_type pos, size_type n) const noexcept; - size_type find(const value_type* s, size_type pos = 0) const noexcept; - size_type find(value_type c, size_type pos = 0) const noexcept; + size_type find(const T& t, size_type pos = 0) const noexcept; // C++17, noexcept as an extension, constexpr since C++20 + size_type find(const value_type* s, size_type pos, size_type n) const noexcept; // constexpr since C++20 + size_type find(const value_type* s, size_type pos = 0) const noexcept; // constexpr since C++20 + size_type find(value_type c, size_type pos = 0) const noexcept; // constexpr since C++20 - size_type rfind(const basic_string& str, size_type pos = npos) const noexcept; + size_type rfind(const basic_string& str, size_type pos = npos) const noexcept; // constexpr since C++20 template - size_type rfind(const T& t, size_type pos = npos) const noexcept; // C++17, noexcept as an extension - size_type rfind(const value_type* s, size_type pos, size_type n) const noexcept; - size_type rfind(const value_type* s, size_type pos = npos) const noexcept; - size_type rfind(value_type c, size_type pos = npos) const noexcept; + size_type rfind(const T& t, size_type pos = npos) const noexcept; // C++17, noexcept as an extension, constexpr since C++20 + size_type rfind(const value_type* s, size_type pos, size_type n) const noexcept; // constexpr since C++20 + size_type rfind(const value_type* s, size_type pos = npos) const noexcept; // constexpr since C++20 + size_type rfind(value_type c, size_type pos = npos) const noexcept; // constexpr since C++20 - size_type find_first_of(const basic_string& str, size_type pos = 0) const noexcept; + size_type find_first_of(const basic_string& str, size_type pos = 0) const noexcept; // constexpr since C++20 template - size_type find_first_of(const T& t, size_type pos = 0) const noexcept; // C++17, noexcept as an extension - size_type find_first_of(const value_type* s, size_type pos, size_type n) const noexcept; - size_type find_first_of(const value_type* s, size_type pos = 0) const noexcept; - size_type find_first_of(value_type c, size_type pos = 0) const noexcept; + size_type find_first_of(const T& t, size_type pos = 0) const noexcept; // C++17, noexcept as an extension, constexpr since C++20 + size_type find_first_of(const value_type* s, size_type pos, size_type n) const noexcept; // constexpr since C++20 + size_type find_first_of(const value_type* s, size_type pos = 0) const noexcept; // constexpr since C++20 + size_type find_first_of(value_type c, size_type pos = 0) const noexcept; // constexpr since C++20 - size_type find_last_of(const basic_string& str, size_type pos = npos) const noexcept; + size_type find_last_of(const basic_string& str, size_type pos = npos) const noexcept; // constexpr since C++20 template - size_type find_last_of(const T& t, size_type pos = npos) const noexcept noexcept; // C++17, noexcept as an extension - size_type find_last_of(const value_type* s, size_type pos, size_type n) const noexcept; - size_type find_last_of(const value_type* s, size_type pos = npos) const noexcept; - size_type find_last_of(value_type c, size_type pos = npos) const noexcept; + size_type find_last_of(const T& t, size_type pos = npos) const noexcept noexcept; // C++17, noexcept as an extension, constexpr since C++20 + size_type find_last_of(const value_type* s, size_type pos, size_type n) const noexcept; // constexpr since C++20 + size_type find_last_of(const value_type* s, size_type pos = npos) const noexcept; // constexpr since C++20 + size_type find_last_of(value_type c, size_type pos = npos) const noexcept; // constexpr since C++20 - size_type find_first_not_of(const basic_string& str, size_type pos = 0) const noexcept; + size_type find_first_not_of(const basic_string& str, size_type pos = 0) const noexcept; // constexpr since C++20 template - size_type find_first_not_of(const T& t, size_type pos = 0) const noexcept; // C++17, noexcept as an extension - size_type find_first_not_of(const value_type* s, size_type pos, size_type n) const noexcept; - size_type find_first_not_of(const value_type* s, size_type pos = 0) const noexcept; - size_type find_first_not_of(value_type c, size_type pos = 0) const noexcept; + size_type find_first_not_of(const T& t, size_type pos = 0) const noexcept; // C++17, noexcept as an extension, constexpr since C++20 + size_type find_first_not_of(const value_type* s, size_type pos, size_type n) const noexcept; // constexpr since C++20 + size_type find_first_not_of(const value_type* s, size_type pos = 0) const noexcept; // constexpr since C++20 + size_type find_first_not_of(value_type c, size_type pos = 0) const noexcept; // constexpr since C++20 - size_type find_last_not_of(const basic_string& str, size_type pos = npos) const noexcept; + size_type find_last_not_of(const basic_string& str, size_type pos = npos) const noexcept; // constexpr since C++20 template - size_type find_last_not_of(const T& t, size_type pos = npos) const noexcept; // C++17, noexcept as an extension - size_type find_last_not_of(const value_type* s, size_type pos, size_type n) const noexcept; - size_type find_last_not_of(const value_type* s, size_type pos = npos) const noexcept; - size_type find_last_not_of(value_type c, size_type pos = npos) const noexcept; + size_type find_last_not_of(const T& t, size_type pos = npos) const noexcept; // C++17, noexcept as an extension, constexpr since C++20 + size_type find_last_not_of(const value_type* s, size_type pos, size_type n) const noexcept; // constexpr since C++20 + size_type find_last_not_of(const value_type* s, size_type pos = npos) const noexcept; // constexpr since C++20 + size_type find_last_not_of(value_type c, size_type pos = npos) const noexcept; // constexpr since C++20 - int compare(const basic_string& str) const noexcept; + int compare(const basic_string& str) const noexcept; // constexpr since C++20 template - int compare(const T& t) const noexcept; // C++17, noexcept as an extension - int compare(size_type pos1, size_type n1, const basic_string& str) const; + int compare(const T& t) const noexcept; // C++17, noexcept as an extension, constexpr since C++20 + int compare(size_type pos1, size_type n1, const basic_string& str) const; // constexpr since C++20 template - int compare(size_type pos1, size_type n1, const T& t) const; // C++17 + int compare(size_type pos1, size_type n1, const T& t) const; // C++17, constexpr since C++20 int compare(size_type pos1, size_type n1, const basic_string& str, - size_type pos2, size_type n2=npos) const; // C++14 + size_type pos2, size_type n2=npos) const; // C++14, constexpr since C++20 template int compare(size_type pos1, size_type n1, const T& t, - size_type pos2, size_type n2=npos) const; // C++17 - int compare(const value_type* s) const noexcept; - int compare(size_type pos1, size_type n1, const value_type* s) const; - int compare(size_type pos1, size_type n1, const value_type* s, size_type n2) const; - - bool starts_with(basic_string_view sv) const noexcept; // C++20 - bool starts_with(charT c) const noexcept; // C++20 - bool starts_with(const charT* s) const; // C++20 - bool ends_with(basic_string_view sv) const noexcept; // C++20 - bool ends_with(charT c) const noexcept; // C++20 - bool ends_with(const charT* s) const; // C++20 - - constexpr bool contains(basic_string_view sv) const noexcept; // C++2b - constexpr bool contains(charT c) const noexcept; // C++2b - constexpr bool contains(const charT* s) const; // C++2b - - bool __invariants() const; + size_type pos2, size_type n2=npos) const; // C++17, constexpr since C++20 + int compare(const value_type* s) const noexcept; // constexpr since C++20 + int compare(size_type pos1, size_type n1, const value_type* s) const; // constexpr since C++20 + int compare(size_type pos1, size_type n1, const value_type* s, size_type n2) const; // constexpr since C++20 + + constexpr bool starts_with(basic_string_view sv) const noexcept; // C++20 + constexpr bool starts_with(charT c) const noexcept; // C++20 + constexpr bool starts_with(const charT* s) const; // C++20 + constexpr bool ends_with(basic_string_view sv) const noexcept; // C++20 + constexpr bool ends_with(charT c) const noexcept; // C++20 + constexpr bool ends_with(const charT* s) const; // C++20 + + constexpr bool contains(basic_string_view sv) const noexcept; // C++2b + constexpr bool contains(charT c) const noexcept; // C++2b + constexpr bool contains(const charT* s) const; // C++2b }; template basic_string operator+(const basic_string& lhs, - const basic_string& rhs); + const basic_string& rhs); // constexpr since C++20 template basic_string -operator+(const charT* lhs , const basic_string&rhs); +operator+(const charT* lhs , const basic_string&rhs); // constexpr since C++20 template basic_string -operator+(charT lhs, const basic_string& rhs); +operator+(charT lhs, const basic_string& rhs); // constexpr since C++20 template basic_string -operator+(const basic_string& lhs, const charT* rhs); +operator+(const basic_string& lhs, const charT* rhs); // constexpr since C++20 template basic_string -operator+(const basic_string& lhs, charT rhs); +operator+(const basic_string& lhs, charT rhs); // constexpr since C++20 template bool operator==(const basic_string& lhs, - const basic_string& rhs) noexcept; + const basic_string& rhs) noexcept; // constexpr since C++20 template -bool operator==(const charT* lhs, const basic_string& rhs) noexcept; +bool operator==(const charT* lhs, const basic_string& rhs) noexcept; // constexpr since C++20 template -bool operator==(const basic_string& lhs, const charT* rhs) noexcept; +bool operator==(const basic_string& lhs, const charT* rhs) noexcept; // constexpr since C++20 template bool operator!=(const basic_string& lhs, - const basic_string& rhs) noexcept; + const basic_string& rhs) noexcept; // constexpr since C++20 template -bool operator!=(const charT* lhs, const basic_string& rhs) noexcept; +bool operator!=(const charT* lhs, const basic_string& rhs) noexcept; // constexpr since C++20 template -bool operator!=(const basic_string& lhs, const charT* rhs) noexcept; +bool operator!=(const basic_string& lhs, const charT* rhs) noexcept; // constexpr since C++20 template bool operator< (const basic_string& lhs, - const basic_string& rhs) noexcept; + const basic_string& rhs) noexcept; // constexpr since C++20 template -bool operator< (const basic_string& lhs, const charT* rhs) noexcept; +bool operator< (const basic_string& lhs, const charT* rhs) noexcept; // constexpr since C++20 template -bool operator< (const charT* lhs, const basic_string& rhs) noexcept; +bool operator< (const charT* lhs, const basic_string& rhs) noexcept; // constexpr since C++20 template bool operator> (const basic_string& lhs, - const basic_string& rhs) noexcept; + const basic_string& rhs) noexcept; // constexpr since C++20 template -bool operator> (const basic_string& lhs, const charT* rhs) noexcept; +bool operator> (const basic_string& lhs, const charT* rhs) noexcept; // constexpr since C++20 template -bool operator> (const charT* lhs, const basic_string& rhs) noexcept; +bool operator> (const charT* lhs, const basic_string& rhs) noexcept; // constexpr since C++20 template bool operator<=(const basic_string& lhs, - const basic_string& rhs) noexcept; + const basic_string& rhs) noexcept; // constexpr since C++20 template -bool operator<=(const basic_string& lhs, const charT* rhs) noexcept; +bool operator<=(const basic_string& lhs, const charT* rhs) noexcept; // constexpr since C++20 template -bool operator<=(const charT* lhs, const basic_string& rhs) noexcept; +bool operator<=(const charT* lhs, const basic_string& rhs) noexcept; // constexpr since C++20 template bool operator>=(const basic_string& lhs, - const basic_string& rhs) noexcept; + const basic_string& rhs) noexcept; // constexpr since C++20 template -bool operator>=(const basic_string& lhs, const charT* rhs) noexcept; +bool operator>=(const basic_string& lhs, const charT* rhs) noexcept; // constexpr since C++20 template -bool operator>=(const charT* lhs, const basic_string& rhs) noexcept; +bool operator>=(const charT* lhs, const basic_string& rhs) noexcept; // constexpr since C++20 template void swap(basic_string& lhs, basic_string& rhs) - noexcept(noexcept(lhs.swap(rhs))); + noexcept(noexcept(lhs.swap(rhs))); // constexpr since C++20 template basic_istream& @@ -508,11 +506,11 @@ template <> struct hash; template <> struct hash; -basic_string operator "" s( const char *str, size_t len ); // C++14 -basic_string operator "" s( const wchar_t *str, size_t len ); // C++14 -basic_string operator "" s( const char8_t *str, size_t len ); // C++20 -basic_string operator "" s( const char16_t *str, size_t len ); // C++14 -basic_string operator "" s( const char32_t *str, size_t len ); // C++14 +basic_string operator "" s( const char *str, size_t len ); // C++14, constexpr since C++20 +basic_string operator "" s( const wchar_t *str, size_t len ); // C++14, constexpr since C++20 +constexpr basic_string operator "" s( const char8_t *str, size_t len ); // C++20 +basic_string operator "" s( const char16_t *str, size_t len ); // C++14, constexpr since C++20 +basic_string operator "" s( const char32_t *str, size_t len ); // C++14, constexpr since C++20 } // std @@ -577,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); @@ -663,8 +665,8 @@ typedef __wrap_iter iterator; typedef __wrap_iter const_iterator; - typedef _VSTD::reverse_iterator reverse_iterator; - typedef _VSTD::reverse_iterator const_reverse_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; private: @@ -751,7 +753,8 @@ // Construct a string with the given allocator and enough storage to hold `__size` characters, but // don't initialize the characters. The contents of the string, including the null terminator, must be // initialized separately. - _LIBCPP_HIDE_FROM_ABI explicit basic_string(__uninitialized_size_tag, size_type __size, const allocator_type& __a) + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 + explicit basic_string(__uninitialized_size_tag, size_type __size, const allocator_type& __a) : __r_(__default_init_tag(), __a) { if (__size > max_size()) __throw_length_error(); @@ -761,6 +764,7 @@ } else { auto __capacity = __recommend(__size) + 1; auto __allocation = __alloc_traits::allocate(__alloc(), __capacity); + __begin_lifetime(__allocation, __capacity); __set_long_cap(__capacity); __set_long_pointer(__allocation); __set_long_size(__size); @@ -772,21 +776,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); @@ -794,12 +798,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)); @@ -807,146 +811,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 @@ -957,55 +966,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 @@ -1013,11 +1034,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 @@ -1027,7 +1048,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()); @@ -1040,41 +1061,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 @@ -1082,11 +1102,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, @@ -1094,7 +1114,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, @@ -1102,15 +1122,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, @@ -1120,22 +1140,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, @@ -1143,7 +1164,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, @@ -1151,45 +1172,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, @@ -1197,14 +1220,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, @@ -1212,16 +1235,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; @@ -1230,123 +1253,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, @@ -1355,7 +1384,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, @@ -1363,20 +1392,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 @@ -1419,15 +1451,9 @@ { return __self_view(data(), size()).contains(__s); } #endif - _LIBCPP_INLINE_VISIBILITY bool __invariants() const; + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool __invariants() const; - _LIBCPP_INLINE_VISIBILITY void __clear_and_shrink() _NOEXCEPT; - - _LIBCPP_INLINE_VISIBILITY void __shrink_or_extend(size_type __target_capacity); - - _LIBCPP_INLINE_VISIBILITY - bool __is_long() const _NOEXCEPT - {return bool(__r_.first().__s.__size_ & __short_mask);} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void __clear_and_shrink() _NOEXCEPT; #if _LIBCPP_DEBUG_LEVEL == 2 @@ -1439,6 +1465,48 @@ #endif // _LIBCPP_DEBUG_LEVEL == 2 private: + template + inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + bool friend operator==(const basic_string, _Alloc>& __lhs, + const basic_string, _Alloc>& __rhs) _NOEXCEPT; + + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void __shrink_or_extend(size_type __target_capacity); + + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool __is_long() const _NOEXCEPT { + if (__libcpp_is_constant_evaluated()) + return true; + return 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()); + } + _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI static bool __fits_in_sso(size_type __sz) { // SSO is disabled during constant evaluation because `__is_long` isn't constexpr friendly return !__libcpp_is_constant_evaluated() && (__sz < __min_cap); @@ -1471,12 +1539,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);} @@ -1484,7 +1552,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;} @@ -1494,7 +1562,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);} @@ -1502,7 +1570,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_;} @@ -1512,73 +1580,84 @@ #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 - void __set_long_cap(size_type __s) _NOEXCEPT - {__r_.first().__l.__cap_ = __long_mask | __s;} - _LIBCPP_INLINE_VISIBILITY - size_type __get_long_cap() const _NOEXCEPT - {return __r_.first().__l.__cap_ & size_type(~__long_mask);} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + void __set_long_cap(size_type __s) _NOEXCEPT { + if (__libcpp_is_constant_evaluated()) + __r_.first().__l.__cap_ = __s; + else + __r_.first().__l.__cap_ = __long_mask | __s; + } + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 + size_type __get_long_cap() const _NOEXCEPT { + if (__libcpp_is_constant_evaluated()) + return __r_.first().__l.__cap_; + 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 (__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. @@ -1589,10 +1668,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 @@ -1600,15 +1679,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); @@ -1617,21 +1698,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()) @@ -1647,6 +1728,7 @@ { allocator_type __a = __str.__alloc(); auto __allocation = std::__allocate_at_least(__a, __str.__get_long_cap()); + __begin_lifetime(__allocation.ptr, __allocation.count); __clear_and_shrink(); __alloc() = _VSTD::move(__a); __set_long_pointer(__allocation.ptr); @@ -1656,15 +1738,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; @@ -1673,7 +1755,7 @@ #endif #endif - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void __move_assign_alloc(basic_string& __str) _NOEXCEPT_( @@ -1682,20 +1764,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) { @@ -1707,19 +1789,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(); } @@ -1734,11 +1819,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 @@ -1785,7 +1870,7 @@ #endif template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::__invalidate_all_iterators() { @@ -1796,7 +1881,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type __pos) { @@ -1826,17 +1911,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) @@ -1845,15 +1930,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; @@ -1866,6 +1954,7 @@ { auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__reserve) + 1); __p = __allocation.ptr; + __begin_lifetime(__p, __allocation.count); __set_long_pointer(__p); __set_long_cap(__allocation.count); __set_long_size(__sz); @@ -1875,9 +1964,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; @@ -1890,6 +1982,7 @@ { auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__sz) + 1); __p = __allocation.ptr; + __begin_lifetime(__p, __allocation.count); __set_long_pointer(__p); __set_long_cap(__allocation.count); __set_long_size(__sz); @@ -1900,6 +1993,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) { @@ -1909,7 +2003,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()) { @@ -1919,7 +2013,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) { @@ -1929,6 +2023,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())) { @@ -1941,6 +2036,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) @@ -1954,8 +2050,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(); @@ -1965,17 +2064,18 @@ __throw_length_error(); auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__sz) + 1); __p = __allocation.ptr; + __begin_lifetime(__p, __allocation.count); __set_long_pointer(__p); __set_long_cap(__allocation.count); __set_long_size(__sz); } - traits_type::copy(_VSTD::__to_address(__p), __s, __sz + 1); + traits_type::copy(std::__to_address(__p), __s, __sz + 1); } #ifndef _LIBCPP_CXX03_LANG template -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) @@ -1984,7 +2084,7 @@ #endif : __r_(_VSTD::move(__str.__r_)) { - __str.__zero(); + __str.__default_init(); _VSTD::__debug_db_insert_c(this); #if _LIBCPP_DEBUG_LEVEL == 2 if (!__libcpp_is_constant_evaluated() && __is_long()) @@ -1993,7 +2093,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) { @@ -2001,8 +2101,13 @@ __init(_VSTD::__to_address(__str.__get_long_pointer()), __str.__get_long_size()); else { - __r_.first().__r = __str.__r_.first().__r; - __str.__zero(); + if (__libcpp_is_constant_evaluated()) { + __zero(); + __r_.first().__l = __str.__r_.first().__l; + } else { + __r_.first().__r = __str.__r_.first().__r; + } + __str.__default_init(); } _VSTD::__debug_db_insert_c(this); #if _LIBCPP_DEBUG_LEVEL == 2 @@ -2014,9 +2119,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; @@ -2029,6 +2137,7 @@ { auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__n) + 1); __p = __allocation.ptr; + __begin_lifetime(__p, __allocation.count); __set_long_pointer(__p); __set_long_cap(__allocation.count); __set_long_size(__n); @@ -2038,7 +2147,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()) { @@ -2048,6 +2157,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) { @@ -2056,6 +2166,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) @@ -2069,7 +2180,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) @@ -2083,6 +2194,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) @@ -2095,6 +2207,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t) : __r_(__default_init_tag(), __default_init_tag()) { @@ -2105,6 +2218,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) { @@ -2115,13 +2229,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 { @@ -2141,12 +2256,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(); @@ -2160,6 +2278,7 @@ { auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__sz) + 1); __p = __allocation.ptr; + __begin_lifetime(__p, __allocation.count); __set_long_pointer(__p); __set_long_cap(__allocation.count); __set_long_size(__sz); @@ -2185,7 +2304,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()) { @@ -2195,7 +2314,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) @@ -2207,7 +2326,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()) @@ -2217,8 +2336,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) @@ -2230,6 +2348,7 @@ #endif // _LIBCPP_CXX03_LANG template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>::~basic_string() { #if _LIBCPP_DEBUG_LEVEL == 2 @@ -2241,6 +2360,7 @@ } 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, @@ -2255,6 +2375,7 @@ __ms - 1; auto __allocation = std::__allocate_at_least(__alloc(), __cap + 1); pointer __p = __allocation.ptr; + __begin_lifetime(__p, __allocation.count); __invalidate_all_iterators(); if (__n_copy != 0) traits_type::copy(_VSTD::__to_address(__p), @@ -2265,7 +2386,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(__allocation.count); @@ -2276,6 +2397,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) { @@ -2288,6 +2410,7 @@ __ms - 1; auto __allocation = std::__allocate_at_least(__alloc(), __cap + 1); pointer __p = __allocation.ptr; + __begin_lifetime(__p, __allocation.count); __invalidate_all_iterators(); if (__n_copy != 0) traits_type::copy(_VSTD::__to_address(__p), @@ -2297,8 +2420,8 @@ traits_type::copy(_VSTD::__to_address(__p) + __n_copy + __n_add, _VSTD::__to_address(__old_p) + __n_copy + __n_del, __sec_cp_sz); - if (__old_cap+1 != __min_cap) - __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1); + if (__libcpp_is_constant_evaluated() || __old_cap + 1 != __min_cap) + __alloc_traits::deallocate(__alloc(), __old_p, __old_cap + 1); __set_long_pointer(__p); __set_long_cap(__allocation.count); } @@ -2307,6 +2430,7 @@ 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) { @@ -2314,7 +2438,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 { @@ -2325,6 +2449,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) { @@ -2341,6 +2466,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n) { @@ -2351,6 +2477,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c) { @@ -2366,6 +2493,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c) { @@ -2387,6 +2515,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str) { @@ -2408,7 +2537,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) @@ -2420,7 +2549,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 @@ -2441,12 +2570,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.__default_init(); + } 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)) @@ -2460,6 +2593,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __is_exactly_cpp17_input_iterator<_InputIterator>::value, @@ -2474,6 +2608,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __is_cpp17_forward_iterator<_ForwardIterator>::value, @@ -2509,6 +2644,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) { @@ -2520,6 +2656,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value @@ -2537,12 +2674,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) { @@ -2556,6 +2695,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) { @@ -2579,6 +2719,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c) { @@ -2598,7 +2739,7 @@ } template -inline void +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline void basic_string<_CharT, _Traits, _Allocator>::__append_default_init(size_type __n) { if (__n) @@ -2615,6 +2756,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c) { @@ -2636,7 +2778,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; @@ -2653,6 +2795,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __is_cpp17_forward_iterator<_ForwardIterator>::value, @@ -2687,7 +2830,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str) { @@ -2695,6 +2838,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) { @@ -2706,6 +2850,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, @@ -2721,6 +2866,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s) { @@ -2731,6 +2877,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) { @@ -2739,6 +2886,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) @@ -2763,6 +2917,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) { @@ -2795,6 +2950,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __is_exactly_cpp17_input_iterator<_InputIterator>::value, @@ -2811,6 +2967,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __is_cpp17_forward_iterator<_ForwardIterator>::value, @@ -2838,7 +2995,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) { @@ -2846,6 +3003,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) @@ -2858,6 +3016,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, @@ -2874,6 +3033,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s) { @@ -2882,6 +3042,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) { @@ -2912,7 +3073,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) { @@ -2927,6 +3088,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 @@ -2939,6 +3101,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) { @@ -2976,6 +3142,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) { @@ -3006,6 +3173,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __is_cpp17_input_iterator<_InputIterator>::value, @@ -3019,7 +3187,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) { @@ -3027,6 +3195,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) @@ -3039,6 +3208,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, @@ -3055,6 +3225,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) { @@ -3063,7 +3234,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) { @@ -3072,7 +3243,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) { @@ -3080,7 +3251,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) { @@ -3088,7 +3259,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) { @@ -3100,6 +3271,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) @@ -3117,6 +3289,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos, size_type __n) { @@ -3131,7 +3304,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 typename basic_string<_CharT, _Traits, _Allocator>::iterator basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos) { @@ -3147,7 +3320,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) { @@ -3163,7 +3336,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::pop_back() { @@ -3172,7 +3345,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::clear() _NOEXCEPT { @@ -3190,7 +3363,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::__erase_to_end(size_type __pos) { @@ -3198,6 +3371,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::resize(size_type __n, value_type __c) { @@ -3209,7 +3383,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(); @@ -3220,7 +3394,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 { @@ -3233,6 +3407,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacity) { @@ -3253,7 +3428,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::shrink_to_fit() _NOEXCEPT { @@ -3264,7 +3439,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target_capacity) { @@ -3273,7 +3448,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; @@ -3307,6 +3482,7 @@ return; #endif // _LIBCPP_NO_EXCEPTIONS } + __begin_lifetime(__new_data, __target_capacity + 1); __now_long = true; __was_long = __is_long(); __p = __get_pointer(); @@ -3327,7 +3503,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 { @@ -3336,7 +3512,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 { @@ -3345,6 +3521,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename basic_string<_CharT, _Traits, _Allocator>::const_reference basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const { @@ -3354,6 +3531,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename basic_string<_CharT, _Traits, _Allocator>::reference basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) { @@ -3363,7 +3541,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 typename basic_string<_CharT, _Traits, _Allocator>::reference basic_string<_CharT, _Traits, _Allocator>::front() _NOEXCEPT { @@ -3372,7 +3550,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 typename basic_string<_CharT, _Traits, _Allocator>::const_reference basic_string<_CharT, _Traits, _Allocator>::front() const _NOEXCEPT { @@ -3381,7 +3559,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 typename basic_string<_CharT, _Traits, _Allocator>::reference basic_string<_CharT, _Traits, _Allocator>::back() _NOEXCEPT { @@ -3390,7 +3568,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 typename basic_string<_CharT, _Traits, _Allocator>::const_reference basic_string<_CharT, _Traits, _Allocator>::back() const _NOEXCEPT { @@ -3399,6 +3577,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 { @@ -3411,7 +3590,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 { @@ -3419,7 +3598,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str) #if _LIBCPP_STD_VER >= 14 @@ -3458,6 +3637,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, @@ -3469,7 +3649,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 @@ -3480,6 +3660,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3494,7 +3675,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 @@ -3505,6 +3686,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 @@ -3516,6 +3698,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, @@ -3527,7 +3710,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 @@ -3538,6 +3721,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3552,7 +3736,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 @@ -3563,6 +3747,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 @@ -3574,6 +3759,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, @@ -3585,7 +3771,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 @@ -3596,6 +3782,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3610,7 +3797,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 @@ -3621,7 +3808,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 @@ -3632,6 +3819,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, @@ -3643,7 +3831,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 @@ -3654,6 +3842,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3668,7 +3857,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 @@ -3679,7 +3868,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 @@ -3690,6 +3879,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, @@ -3701,7 +3891,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 @@ -3712,6 +3902,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3726,7 +3917,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 @@ -3737,7 +3928,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 @@ -3749,6 +3940,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, @@ -3760,7 +3952,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 @@ -3771,6 +3963,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3785,7 +3978,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 @@ -3796,7 +3989,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 @@ -3809,6 +4002,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3831,7 +4025,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 int basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const _NOEXCEPT { @@ -3839,6 +4033,7 @@ } template +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 int basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, @@ -3863,6 +4058,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, @@ -3877,7 +4073,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 int basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, @@ -3888,6 +4084,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __enable_if_t < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value @@ -3905,6 +4102,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 int basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, @@ -3916,6 +4114,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 int basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const _NOEXCEPT { @@ -3924,6 +4123,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 int basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, @@ -3936,7 +4136,7 @@ // __invariants template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 bool basic_string<_CharT, _Traits, _Allocator>::__invariants() const { @@ -3954,7 +4154,7 @@ // __clear_and_shrink template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 void basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT { @@ -3971,7 +4171,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 @@ -3983,7 +4183,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 @@ -4002,7 +4202,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 @@ -4015,7 +4215,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 @@ -4028,7 +4228,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 @@ -4037,7 +4237,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 @@ -4046,7 +4246,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 @@ -4057,7 +4257,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 @@ -4066,7 +4266,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 @@ -4075,7 +4275,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 @@ -4086,7 +4286,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 @@ -4095,7 +4295,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 @@ -4104,7 +4304,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 @@ -4115,7 +4315,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 @@ -4124,7 +4324,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 @@ -4133,7 +4333,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 @@ -4144,7 +4344,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 @@ -4153,7 +4353,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 @@ -4162,7 +4362,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 @@ -4173,6 +4373,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) @@ -4191,6 +4392,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator> operator+(const _CharT* __lhs , const basic_string<_CharT,_Traits,_Allocator>& __rhs) { @@ -4208,6 +4410,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator> operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { @@ -4224,7 +4427,7 @@ } template -inline +inline _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator> operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) { @@ -4242,6 +4445,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string<_CharT, _Traits, _Allocator> operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs) { @@ -4260,7 +4464,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) { @@ -4268,7 +4472,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) { @@ -4276,7 +4480,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) { @@ -4284,7 +4488,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) { @@ -4292,7 +4496,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) { @@ -4301,7 +4505,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) { @@ -4309,7 +4513,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) { @@ -4322,7 +4526,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) @@ -4487,14 +4691,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); @@ -4502,20 +4706,20 @@ #endif #ifndef _LIBCPP_HAS_NO_CHAR8_T - inline _LIBCPP_INLINE_VISIBILITY + inline _LIBCPP_INLINE_VISIBILITY constexpr 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 @@ -316,7 +316,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] @@ -2731,8 +2731,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 @@ -3975,8 +3975,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 @@ -8,8 +8,8 @@ // -// const_reference at(size_type pos) const; -// reference at(size_type pos); +// const_reference at(size_type pos) const; // constexpr since C++20 +// reference at(size_type pos); // constexpr since C++20 #include #include @@ -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 @@ -8,8 +8,8 @@ // -// const charT& back() const; -// charT& back(); +// const charT& back() const; // constexpr since C++20 +// charT& back(); // constexpr since C++20 #include #include @@ -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 @@ -8,8 +8,8 @@ // -// const charT& front() const; -// charT& front(); +// const charT& front() const; // constexpr since C++20 +// charT& front(); // constexpr since C++20 #include #include @@ -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 @@ -8,8 +8,8 @@ // -// const_reference operator[](size_type pos) const; -// reference operator[](size_type pos); +// const_reference operator[](size_type pos) const; // constexpr since C++20 +// reference operator[](size_type pos); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type capacity() const; +// size_type capacity() const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// void clear(); +// void clear(); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// bool empty() const noexcept; +// bool empty() const noexcept; // constexpr since C++20 #include #include @@ -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 @@ -10,7 +10,7 @@ // class deque -// bool empty() const noexcept; +// bool empty() const noexcept; // constexpr since C++20 // UNSUPPORTED: c++03, c++11, c++14, c++17 @@ -18,7 +18,7 @@ #include "test_macros.h" -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { std::string c; c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} @@ -29,7 +29,7 @@ { test(); #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 @@ -8,7 +8,7 @@ // -// size_type length() const; +// size_type length() const; // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // UNSUPPORTED: no-exceptions // -// size_type max_size() const; +// size_type max_size() const; // constexpr since C++20 // NOTE: asan and msan will fail for one of two reasons // 1. If allocator_may_return_null=0 then they will fail because the allocation @@ -25,7 +25,7 @@ #include "min_allocator.h" template -void +TEST_CONSTEXPR_CXX20 void test1(const S& s) { S s2(s); @@ -36,7 +36,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test2(const S& s) { S s2(s); @@ -47,7 +47,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s) { assert(s.max_size() >= s.size()); @@ -55,7 +55,7 @@ test2(s); } -bool test() { +void test() { { typedef std::string S; test(S()); @@ -70,15 +70,25 @@ test(S("12345678901234567890123456789012345678901234567890")); } #endif +} + +#if TEST_STD_VER > 17 +constexpr bool test_constexpr() { + std::string str; + + size_t size = str.max_size(); + assert(size > 0); return true; } +#endif int main(int, char**) { test(); #if TEST_STD_VER > 17 - // static_assert(test()); + test_constexpr(); + static_assert(test_constexpr()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp --- 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 @@ -11,7 +11,7 @@ // -// size_type max_size() const; +// size_type max_size() const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// void reserve(size_type res_arg); +// void reserve(size_type res_arg); // constexpr since C++20 // This test relies on https://llvm.org/PR45368 being fixed, which isn't in // older Apple dylibs @@ -62,7 +62,7 @@ #endif } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef std::string S; { @@ -105,7 +105,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_and_overwrite.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/resize_and_overwrite.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.capacity/resize_and_overwrite.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.capacity/resize_and_overwrite.pass.cpp @@ -90,18 +90,14 @@ test(); test(); -#if defined(__cpp_lib_constexpr_string) && __cpp_lib_constexpr_string >= 201907L static_assert(test()); static_assert(test()); static_assert(test()); static_assert(test()); -#endif #ifndef TEST_HAS_NO_WIDE_CHARACTERS test(); -#if defined(__cpp_lib_constexpr_string) && __cpp_lib_constexpr_string >= 201907L static_assert(test()); -#endif #endif return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp --- 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 @@ -8,7 +8,7 @@ // -// void resize(size_type n); +// void resize(size_type n); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// void resize(size_type n, charT c); +// void resize(size_type n, charT c); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// void shrink_to_fit(); +// void shrink_to_fit(); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type size() const; +// size_type size() const; // constexpr since C++20 #include #include @@ -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 @@ -10,7 +10,7 @@ // template // basic_string(const _Tp& __t, size_type __pos, size_type __n, -// const allocator_type& __a = allocator_type()); +// const allocator_type& __a = allocator_type()); // constexpr since C++20 // // Mostly we're testing string_view here @@ -91,7 +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 @@ -8,7 +8,7 @@ // -// explicit basic_string(const Allocator& a = Allocator()); +// explicit basic_string(const Allocator& a = Allocator()); // constexpr since C++20 #include #include @@ -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 @@ -11,14 +11,14 @@ // // basic_string& -// operator=(basic_string&& str); +// operator=(basic_string&& str); // constexpr since C++20 #include #include #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 @@ -8,7 +8,7 @@ // -// basic_string& operator=(charT c); +// basic_string& operator=(charT c); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// basic_string(const basic_string& str); +// basic_string(const basic_string& str); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// basic_string(const basic_string& str, const Allocator& alloc); +// basic_string(const basic_string& str, const Allocator& alloc); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// operator=(const basic_string& str); +// operator=(const basic_string& str); // constexpr since C++20 #include #include @@ -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/default.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/default.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.cons/default.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.cons/default.pass.cpp @@ -8,7 +8,7 @@ // -// basic_string() noexcept(is_nothrow_default_constructible::value); +// basic_string() noexcept(is_nothrow_default_constructible::value); // constexpr since C++20 #include #include @@ -25,7 +25,7 @@ std::basic_string, limited_allocator>>::value, ""); #endif -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { std::string str; assert(str.empty()); @@ -36,7 +36,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/dtor.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/dtor.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.cons/dtor.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.cons/dtor.pass.cpp @@ -10,7 +10,7 @@ // -// ~basic_string() // implied noexcept; +// ~basic_string() // implied noexcept; // constexpr since C++20 #include #include @@ -40,7 +40,7 @@ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible< std::basic_string, throwing_alloc>>::value, ""); -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { test_allocator_statistics alloc_stats; { std::basic_string, test_allocator> str2((test_allocator(&alloc_stats))); @@ -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.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 @@ -10,7 +10,7 @@ // -// basic_string(initializer_list il, const Allocator& a = Allocator()); +// basic_string(initializer_list il, const Allocator& a = Allocator()); // constexpr since C++20 #include #include @@ -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 @@ -10,7 +10,7 @@ // -// basic_string& operator=(initializer_list il); +// basic_string& operator=(initializer_list il); // constexpr since C++20 #include #include @@ -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 @@ -10,7 +10,7 @@ // template // basic_string(InputIterator begin, InputIterator end, -// const Allocator& a = Allocator()); +// const Allocator& a = Allocator()); // constexpr since C++20 #include @@ -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 @@ -14,7 +14,7 @@ // basic_string(InputIterator, InputIterator, Allocator = Allocator()) // -> basic_string::value_type, // char_traits::value_type>, -// Allocator>; +// Allocator>; // constexpr since C++20 // // The deduction guide shall not participate in overload resolution if InputIterator // is a type that does not qualify as an input iterator, or if Allocator is a type @@ -49,7 +49,7 @@ static_assert(!CanDeduce>::value); static_assert(!CanDeduce>::value); -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { const char* s = "12345678901234"; std::basic_string s1(s, s+10); // Can't use {} here @@ -108,7 +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.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 @@ -10,7 +10,7 @@ // -// basic_string(basic_string&& str); +// basic_string(basic_string&& str); // constexpr since C++20 #include #include @@ -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 @@ -10,7 +10,7 @@ // -// basic_string(basic_string&& str, const Allocator& alloc); +// basic_string(basic_string&& str, const Allocator& alloc); // constexpr since C++20 #include #include @@ -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 @@ -13,12 +13,12 @@ // basic_string& operator=(basic_string&& c) // noexcept( // allocator_traits::propagate_on_container_move_assignment::value || -// allocator_traits::is_always_equal::value); // C++17 +// allocator_traits::is_always_equal::value); // C++17, constexpr since C++20 // // before C++17, we use the conforming extension // noexcept( // allocator_type::propagate_on_container_move_assignment::value && -// is_nothrow_move_assignable::value); +// is_nothrow_move_assignable::value); // constexpr since C++20 #include #include @@ -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 @@ -11,7 +11,7 @@ // // basic_string& -// operator=(basic_string&& str); +// operator=(basic_string&& str); // constexpr since C++20 #include #include @@ -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/move_noexcept.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/move_noexcept.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.cons/move_noexcept.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.cons/move_noexcept.pass.cpp @@ -11,7 +11,7 @@ // // basic_string(basic_string&&) -// noexcept(is_nothrow_move_constructible::value); +// noexcept(is_nothrow_move_constructible::value); // constexpr since C++20 // This tests a conforming extension diff --git a/libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp @@ -8,7 +8,7 @@ // -// basic_string(const charT* s, const Allocator& a = Allocator()); +// basic_string(const charT* s, const Allocator& a = Allocator()); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// operator=(const charT* s); +// operator=(const charT* s); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// basic_string(const charT* s, size_type n, const Allocator& a = Allocator()); +// basic_string(const charT* s, size_type n, const Allocator& a = Allocator()); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// basic_string(size_type n, charT c, const Allocator& a = Allocator()); +// basic_string(size_type n, charT c, const Allocator& a = Allocator()); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// explicit basic_string(basic_string_view sv, const Allocator& a = Allocator()); +// explicit basic_string(basic_string_view sv, const Allocator& a = Allocator()); // constexpr since C++20 #include #include @@ -75,7 +75,7 @@ } } -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { typedef test_allocator A; typedef std::basic_string_view > SV; @@ -118,7 +118,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 @@ -8,7 +8,7 @@ // -// basic_string& operator=(basic_string_view sv); +// basic_string& operator=(basic_string_view sv); // constexpr since C++20 #include #include @@ -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 @@ -43,7 +43,7 @@ static_assert( CanDeduce>::value); static_assert(!CanDeduce::value); -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { std::string_view sv = "12345678901234"; std::basic_string s1(sv); @@ -77,7 +77,7 @@ assert(s1.compare(0, s1.size(), sv.data(), s1.size()) == 0); } #endif -#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L +#ifndef TEST_HAS_NO_CHAR8_T { std::u8string_view sv = u8"12345678901234"; std::basic_string s1{sv, min_allocator{}}; @@ -117,7 +117,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 @@ -47,7 +47,7 @@ static_assert( CanDeduce>::value); static_assert(!CanDeduce::value); -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { { std::string_view sv = "12345678901234"; std::basic_string s1{sv, 0, 4}; @@ -81,7 +81,7 @@ assert(s1.compare(0, s1.size(), sv.data(), s1.size()) == 0); } #endif -#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L +#ifndef TEST_HAS_NO_CHAR8_T { std::u8string_view sv = u8"12345678901234"; std::basic_string s1{sv, 0, 4, min_allocator{}}; @@ -121,7 +121,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 @@ -10,11 +10,11 @@ // basic_string(const basic_string& str, // size_type pos, size_type n, -// const Allocator& a = Allocator()); +// const Allocator& a = Allocator()); // constexpr since C++20 // // basic_string(const basic_string& str, // size_type pos, -// const Allocator& a = Allocator()); +// const Allocator& a = Allocator()); // constexpr since C++20 #include #include @@ -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 @@ -9,14 +9,14 @@ // -// constexpr bool contains(charT x) const noexcept; +// constexpr bool contains(charT x) const noexcept; #include #include #include "test_macros.h" -bool test() +constexpr bool test() { using S = std::string; @@ -38,9 +38,7 @@ int main(int, char**) { test(); -#if TEST_STD_VER > 17 - // static_assert(test()); -#endif + static_assert(test()); return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp b/libcxx/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.contains/contains.ptr.pass.cpp @@ -9,14 +9,14 @@ // -// constexpr bool contains(const CharT *x) const; +// constexpr bool contains(const CharT *x) const; #include #include #include "test_macros.h" -bool test() +constexpr bool test() { using S = std::string; @@ -68,9 +68,7 @@ int main(int, char**) { test(); -#if TEST_STD_VER > 17 - // static_assert(test()); -#endif + static_assert(test()); return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.contains/contains.string_view.pass.cpp @@ -9,14 +9,14 @@ // -// constexpr bool contains(basic_string_view x) const noexcept; +// constexpr bool contains(basic_string_view x) const noexcept; #include #include #include "test_macros.h" -bool test() +constexpr bool test() { using S = std::string; using SV = std::string_view; @@ -89,9 +89,7 @@ int main(int, char**) { test(); -#if TEST_STD_VER > 17 - // static_assert(test()); -#endif + static_assert(test()); return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.char.pass.cpp b/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.char.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.char.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.char.pass.cpp @@ -9,14 +9,14 @@ // -// bool ends_with(charT x) const noexcept; +// constexpr bool ends_with(charT x) const noexcept; #include #include #include "test_macros.h" -bool test() { +constexpr bool test() { { typedef std::string S; S s1 {}; @@ -36,9 +36,7 @@ int main(int, char**) { test(); -#if TEST_STD_VER > 17 - // static_assert(test()); -#endif + static_assert(test()); return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.ptr.pass.cpp b/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.ptr.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.ptr.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.ptr.pass.cpp @@ -9,14 +9,14 @@ // -// bool ends_with(const CharT *x) const; +// constexpr bool ends_with(const CharT *x) const; #include #include #include "test_macros.h" -bool test() { +constexpr bool test() { { typedef std::string S; const char *s = "abcde"; @@ -64,9 +64,7 @@ int main(int, char**) { test(); -#if TEST_STD_VER > 17 - // static_assert(test()); -#endif + static_assert(test()); return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.string_view.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.string_view.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ends_with/ends_with.string_view.pass.cpp @@ -9,14 +9,14 @@ // -// bool ends_with(basic_string_view x) const noexcept; +// constexpr bool ends_with(basic_string_view x) const noexcept; #include #include #include "test_macros.h" -bool test() { +constexpr bool test() { { typedef std::string S; typedef std::string_view SV; @@ -73,9 +73,7 @@ int main(int, char**) { test(); -#if TEST_STD_VER > 17 - // static_assert(test()); -#endif + static_assert(test()); return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.iterators/begin.pass.cpp b/libcxx/test/std/strings/basic.string/string.iterators/begin.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.iterators/begin.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.iterators/begin.pass.cpp @@ -8,8 +8,8 @@ // -// iterator begin(); -// const_iterator begin() const; +// iterator begin(); // constexpr since C++20 +// const_iterator begin() const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// const_iterator cbegin() const; +// const_iterator cbegin() const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// const_iterator cend() const; +// const_iterator cend() const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// const_reverse_iterator crbegin() const; +// const_reverse_iterator crbegin() const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// const_reverse_iterator crend() const; +// const_reverse_iterator crend() const; // constexpr since C++20 #include #include @@ -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 @@ -8,8 +8,8 @@ // -// iterator end(); -// const_iterator end() const; +// iterator end(); // constexpr since C++20 +// const_iterator end() const; // constexpr since C++20 #include #include @@ -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/iterators.pass.cpp b/libcxx/test/std/strings/basic.string/string.iterators/iterators.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.iterators/iterators.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.iterators/iterators.pass.cpp @@ -10,12 +10,12 @@ // -// iterator begin(); -// iterator end(); -// const_iterator begin() const; -// const_iterator end() const; -// const_iterator cbegin() const; -// const_iterator cend() const; +// iterator begin(); // constexpr since C++20 +// iterator end(); // constexpr since C++20 +// const_iterator begin() const; // constexpr since C++20 +// const_iterator end() const; // constexpr since C++20 +// const_iterator cbegin() const; // constexpr since C++20 +// const_iterator cend() const; // constexpr since C++20 #include #include @@ -65,7 +65,7 @@ test(); #endif -#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L +#ifndef TEST_HAS_NO_CHAR8_T test(); #endif @@ -78,7 +78,7 @@ int main(int, char**) { test(); -#if defined(__cpp_lib_constexpr_string) && __cpp_lib_constexpr_string >= 201907L +#if TEST_STD_VER > 17 static_assert(test()); #endif return 0; diff --git a/libcxx/test/std/strings/basic.string/string.iterators/rbegin.pass.cpp b/libcxx/test/std/strings/basic.string/string.iterators/rbegin.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.iterators/rbegin.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.iterators/rbegin.pass.cpp @@ -8,8 +8,8 @@ // -// reverse_iterator rbegin(); -// const_reverse_iterator rbegin() const; +// reverse_iterator rbegin(); // constexpr since C++20 +// const_reverse_iterator rbegin() const; // constexpr since C++20 #include #include @@ -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 @@ -8,8 +8,8 @@ // -// reverse_iterator rend(); -// const_reverse_iterator rend() const; +// reverse_iterator rend(); // constexpr since C++20 +// const_reverse_iterator rend() const; // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // template -// basic_string& append(const T& t, size_type pos, size_type n=npos); // C++17 +// basic_string& append(const T& t, size_type pos, size_type n=npos); // C++17, constexpr since C++20 #include #include @@ -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 @@ -10,7 +10,7 @@ // -// basic_string& append(initializer_list il); +// basic_string& append(initializer_list il); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // template -// basic_string& append(InputIterator first, InputIterator last); +// basic_string& append(InputIterator first, InputIterator last); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// basic_string& append(const charT* s); +// basic_string& append(const charT* s); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// append(const charT* s, size_type n); +// append(const charT* s, size_type n); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// void push_back(charT c) +// void push_back(charT c) // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// append(size_type n, charT c); +// append(size_type n, charT c); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// append(const basic_string& str); +// append(const basic_string& str); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// append(const basic_string& str, size_type pos, size_type n = npos); +// append(const basic_string& str, size_type pos, size_type n = npos); // constexpr since C++20 // the "= npos" was added for C++14 #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// append(basic_string_view sv); +// append(basic_string_view sv); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // template -// basic_string& assign(const T& t, size_type pos, size_type n=npos); // C++17 +// basic_string& assign(const T& t, size_type pos, size_type n=npos); // C++17, constexpr since C++20 #include #include @@ -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 @@ -10,7 +10,7 @@ // -// basic_string& assign(initializer_list il); +// basic_string& assign(initializer_list il); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // template -// basic_string& assign(InputIterator first, InputIterator last); +// basic_string& assign(InputIterator first, InputIterator last); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// basic_string& assign(const charT* s); +// basic_string& assign(const charT* s); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// assign(const charT* s, size_type n); +// assign(const charT* s, size_type n); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// assign(basic_string&& str); +// assign(basic_string&& str); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// assign(size_type n, charT c); +// assign(size_type n, charT c); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// assign(const basic_string& str); +// assign(const basic_string& str); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// assign(const basic_string& str, size_type pos, size_type n=npos); +// assign(const basic_string& str, size_type pos, size_type n=npos); // constexpr since C++20 // the =npos was added for C++14 #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// assign(basic_string_view sv); +// assign(basic_string_view sv); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type copy(charT* s, size_type n, size_type pos = 0) const; +// size_type copy(charT* s, size_type n, size_type pos = 0) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// iterator erase(const_iterator p); +// iterator erase(const_iterator p); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// iterator erase(const_iterator first, const_iterator last); +// iterator erase(const_iterator first, const_iterator last); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// void pop_back(); +// void pop_back(); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// erase(size_type pos = 0, size_type n = npos); +// erase(size_type pos = 0, size_type n = npos); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// iterator insert(const_iterator p, charT c); +// iterator insert(const_iterator p, charT c); // constexpr since C++20 #include #include @@ -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 @@ -10,7 +10,7 @@ // -// iterator insert(const_iterator p, initializer_list il); +// iterator insert(const_iterator p, initializer_list il); // constexpr since C++20 #include @@ -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 @@ -9,7 +9,7 @@ // // template -// iterator insert(const_iterator p, InputIterator first, InputIterator last); +// iterator insert(const_iterator p, InputIterator first, InputIterator last); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// iterator insert(const_iterator p, size_type n, charT c); +// iterator insert(const_iterator p, size_type n, charT c); // constexpr since C++20 #include #include @@ -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_T_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp @@ -9,7 +9,7 @@ // // template -// basic_string& assign(size_type pos1, const T& t, size_type pos2, size_type n=npos); // C++17 +// basic_string& assign(size_type pos1, const T& t, size_type pos2, size_type n=npos); // C++17, constexpr since C++20 // // Mostly we're testing string_view here @@ -35,7 +35,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -65,7 +65,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -1792,7 +1792,7 @@ } template -bool test31() { +TEST_CONSTEXPR_CXX20 bool test31() { S s; SV sv = "EFGH"; char arr[] = "IJKL"; @@ -1864,38 +1864,38 @@ test31(); #if TEST_STD_VER > 17 - // static_assert(test0()); - // static_assert(test1()); - // static_assert(test2()); - // static_assert(test3()); - // static_assert(test4()); - // static_assert(test5()); - // static_assert(test6()); - // static_assert(test7()); - // static_assert(test8()); - // static_assert(test9()); - // static_assert(test10()); - // static_assert(test11()); - // static_assert(test12()); - // static_assert(test13()); - // static_assert(test14()); - // static_assert(test15()); - // static_assert(test16()); - // static_assert(test17()); - // static_assert(test18()); - // static_assert(test19()); - // static_assert(test20()); - // static_assert(test21()); - // static_assert(test22()); - // static_assert(test23()); - // static_assert(test24()); - // static_assert(test25()); - // static_assert(test26()); - // static_assert(test27()); - // static_assert(test28()); - // static_assert(test29()); - // static_assert(test30()); - // static_assert(test31()); + static_assert(test0()); + static_assert(test1()); + static_assert(test2()); + static_assert(test3()); + static_assert(test4()); + static_assert(test5()); + static_assert(test6()); + static_assert(test7()); + static_assert(test8()); + static_assert(test9()); + static_assert(test10()); + static_assert(test11()); + static_assert(test12()); + static_assert(test13()); + static_assert(test14()); + static_assert(test15()); + static_assert(test16()); + static_assert(test17()); + static_assert(test18()); + static_assert(test19()); + static_assert(test20()); + static_assert(test21()); + static_assert(test22()); + static_assert(test23()); + static_assert(test24()); + static_assert(test25()); + static_assert(test26()); + static_assert(test27()); + static_assert(test28()); + static_assert(test29()); + static_assert(test30()); + static_assert(test31()); #endif } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp --- 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 @@ -9,7 +9,7 @@ // // basic_string& -// insert(size_type pos, const charT* s); +// insert(size_type pos, const charT* s); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// insert(size_type pos, const charT* s, size_type n); +// insert(size_type pos, const charT* s, size_type n); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// insert(size_type pos, size_type n, charT c); +// insert(size_type pos, size_type n, charT c); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// insert(size_type pos1, const basic_string& str); +// insert(size_type pos1, const basic_string& str); // constexpr since C++20 #include #include @@ -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/size_string_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp @@ -10,7 +10,7 @@ // basic_string& // insert(size_type pos1, const basic_string& str, -// size_type pos2, size_type n=npos); +// size_type pos2, size_type n=npos); // constexpr since C++20 // the "=npos" was added in C++14 #include @@ -34,7 +34,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -63,7 +63,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -1824,37 +1824,37 @@ test30(); #if TEST_STD_VER > 17 - // static_assert(test0()); - // static_assert(test1()); - // static_assert(test2()); - // static_assert(test3()); - // static_assert(test4()); - // static_assert(test5()); - // static_assert(test6()); - // static_assert(test7()); - // static_assert(test8()); - // static_assert(test9()); - // static_assert(test10()); - // static_assert(test11()); - // static_assert(test12()); - // static_assert(test13()); - // static_assert(test14()); - // static_assert(test15()); - // static_assert(test16()); - // static_assert(test17()); - // static_assert(test18()); - // static_assert(test19()); - // static_assert(test20()); - // static_assert(test21()); - // static_assert(test22()); - // static_assert(test23()); - // static_assert(test24()); - // static_assert(test25()); - // static_assert(test26()); - // static_assert(test27()); - // static_assert(test28()); - // static_assert(test29()); - // static_assert(test30()); + static_assert(test0()); + static_assert(test1()); + static_assert(test2()); + static_assert(test3()); + static_assert(test4()); + static_assert(test5()); + static_assert(test6()); + static_assert(test7()); + static_assert(test8()); + static_assert(test9()); + static_assert(test10()); + static_assert(test11()); + static_assert(test12()); + static_assert(test13()); + static_assert(test14()); + static_assert(test15()); + static_assert(test16()); + static_assert(test17()); + static_assert(test18()); + static_assert(test19()); + static_assert(test20()); + static_assert(test21()); + static_assert(test22()); + static_assert(test23()); + static_assert(test24()); + static_assert(test25()); + static_assert(test26()); + static_assert(test27()); + static_assert(test28()); + static_assert(test29()); + static_assert(test30()); #endif } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp --- 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 @@ -9,7 +9,7 @@ // // basic_string& -// insert(size_type pos, string_view sv); +// insert(size_type pos, string_view sv); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// basic_string& operator+=(charT c); +// basic_string& operator+=(charT c); // constexpr since C++20 #include #include @@ -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 @@ -10,7 +10,7 @@ // -// basic_string& operator+=(initializer_list il); +// basic_string& operator+=(initializer_list il); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// basic_string& operator+=(const charT* s); +// basic_string& operator+=(const charT* s); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// operator+=(const basic_string& str); +// operator+=(const basic_string& str); // constexpr since C++20 #include #include @@ -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 @@ -10,7 +10,7 @@ // -// basic_string& replace(const_iterator i1, const_iterator i2, initializer_list il); +// basic_string& replace(const_iterator i1, const_iterator i2, initializer_list il); // constexpr since C++20 #include #include @@ -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_iter_iter.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp @@ -10,7 +10,7 @@ // template // basic_string& -// replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2); +// replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2); // constexpr since C++20 #include #include @@ -63,7 +63,7 @@ } #endif -const char* str = "12345678901234567890"; +TEST_CONSTEXPR const char* str = "12345678901234567890"; template TEST_CONSTEXPR_CXX20 bool test0() @@ -993,9 +993,9 @@ } template -bool test9() { +TEST_CONSTEXPR_CXX20 bool test9() { #ifndef TEST_HAS_NO_EXCEPTIONS - { // test iterator operations that throw + if (!TEST_IS_CONSTANT_EVALUATED) { // test iterator operations that throw typedef ThrowingIterator TIter; typedef cpp17_input_iterator IIter; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -1057,16 +1057,16 @@ test9(); #if TEST_STD_VER > 17 - // static_assert(test0()); - // static_assert(test1()); - // static_assert(test2()); - // static_assert(test3()); - // static_assert(test4()); - // static_assert(test5()); - // static_assert(test6()); - // static_assert(test7()); - // static_assert(test8()); - // static_assert(test9()); + static_assert(test0()); + static_assert(test1()); + static_assert(test2()); + static_assert(test3()); + static_assert(test4()); + static_assert(test5()); + static_assert(test6()); + static_assert(test7()); + static_assert(test8()); + static_assert(test9()); #endif } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp --- 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 @@ -9,7 +9,7 @@ // // basic_string& -// replace(const_iterator i1, const_iterator i2, const charT* s); +// replace(const_iterator i1, const_iterator i2, const charT* s); // constexpr since C++20 #include @@ -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_pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp @@ -9,7 +9,7 @@ // // basic_string& -// replace(const_iterator i1, const_iterator i2, const charT* s, size_type n); +// replace(const_iterator i1, const_iterator i2, const charT* s, size_type n); // constexpr since C++20 #include #include @@ -962,7 +962,7 @@ } template -bool test9() { +TEST_CONSTEXPR_CXX20 bool test9() { S s_short = "123/"; S s_long = "Lorem ipsum dolor sit amet, consectetur/"; @@ -993,16 +993,16 @@ test9(); #if TEST_STD_VER > 17 - // static_assert(test0()); - // static_assert(test1()); - // static_assert(test2()); - // static_assert(test3()); - // static_assert(test4()); - // static_assert(test5()); - // static_assert(test6()); - // static_assert(test7()); - // static_assert(test8()); - // static_assert(test9()); + static_assert(test0()); + static_assert(test1()); + static_assert(test2()); + static_assert(test3()); + static_assert(test4()); + static_assert(test5()); + static_assert(test6()); + static_assert(test7()); + static_assert(test8()); + static_assert(test9()); #endif } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp --- 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 @@ -9,7 +9,7 @@ // // basic_string& -// replace(const_iterator i1, const_iterator i2, size_type n, charT c); +// replace(const_iterator i1, const_iterator i2, size_type n, charT c); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// replace(const_iterator i1, const_iterator i2, const basic_string& str); +// replace(const_iterator i1, const_iterator i2, const basic_string& str); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// replace(const_iterator i1, const_iterator i2, basic_string_view sv); +// replace(const_iterator i1, const_iterator i2, basic_string_view sv); // constexpr since C++20 #include #include @@ -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 @@ -10,7 +10,7 @@ // template // basic_string& replace(size_type pos1, size_type n1, const T& t, -// size_type pos2, size_type n=npos); +// size_type pos2, size_type n=npos); // constexpr since C++20 // // Mostly we're testing string_view here @@ -47,7 +47,7 @@ assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -83,7 +83,7 @@ assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -5981,7 +5981,7 @@ return true; } -bool test56() { +TEST_CONSTEXPR_CXX20 bool test56() { typedef std::string S; typedef std::string_view SV; S s0 = "ABCD"; @@ -6017,7 +6017,7 @@ } template -bool test() { +TEST_CONSTEXPR_CXX20 bool test() { test0(); test1(); test2(); @@ -6076,62 +6076,62 @@ test55(); #if TEST_STD_VER > 17 - // static_assert(test0()); - // static_assert(test1()); - // static_assert(test2()); - // static_assert(test3()); - // static_assert(test4()); - // static_assert(test5()); - // static_assert(test6()); - // static_assert(test7()); - // static_assert(test8()); - // static_assert(test9()); - // static_assert(test10()); - // static_assert(test11()); - // static_assert(test12()); - // static_assert(test13()); - // static_assert(test14()); - // static_assert(test15()); - // static_assert(test16()); - // static_assert(test17()); - // static_assert(test18()); - // static_assert(test19()); - // static_assert(test20()); - // static_assert(test21()); - // static_assert(test22()); - // static_assert(test23()); - // static_assert(test24()); - // static_assert(test25()); - // static_assert(test26()); - // static_assert(test27()); - // static_assert(test28()); - // static_assert(test29()); - // static_assert(test30()); - // static_assert(test31()); - // static_assert(test32()); - // static_assert(test33()); - // static_assert(test34()); - // static_assert(test35()); - // static_assert(test36()); - // static_assert(test37()); - // static_assert(test38()); - // static_assert(test39()); - // static_assert(test40()); - // static_assert(test41()); - // static_assert(test42()); - // static_assert(test43()); - // static_assert(test44()); - // static_assert(test45()); - // static_assert(test46()); - // static_assert(test47()); - // static_assert(test48()); - // static_assert(test49()); - // static_assert(test50()); - // static_assert(test51()); - // static_assert(test52()); - // static_assert(test53()); - // static_assert(test54()); - // static_assert(test55()); + static_assert(test0()); + static_assert(test1()); + static_assert(test2()); + static_assert(test3()); + static_assert(test4()); + static_assert(test5()); + static_assert(test6()); + static_assert(test7()); + static_assert(test8()); + static_assert(test9()); + static_assert(test10()); + static_assert(test11()); + static_assert(test12()); + static_assert(test13()); + static_assert(test14()); + static_assert(test15()); + static_assert(test16()); + static_assert(test17()); + static_assert(test18()); + static_assert(test19()); + static_assert(test20()); + static_assert(test21()); + static_assert(test22()); + static_assert(test23()); + static_assert(test24()); + static_assert(test25()); + static_assert(test26()); + static_assert(test27()); + static_assert(test28()); + static_assert(test29()); + static_assert(test30()); + static_assert(test31()); + static_assert(test32()); + static_assert(test33()); + static_assert(test34()); + static_assert(test35()); + static_assert(test36()); + static_assert(test37()); + static_assert(test38()); + static_assert(test39()); + static_assert(test40()); + static_assert(test41()); + static_assert(test42()); + static_assert(test43()); + static_assert(test44()); + static_assert(test45()); + static_assert(test46()); + static_assert(test47()); + static_assert(test48()); + static_assert(test49()); + static_assert(test50()); + static_assert(test51()); + static_assert(test52()); + static_assert(test53()); + static_assert(test54()); + static_assert(test55()); #endif return true; diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp --- 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 @@ -9,7 +9,7 @@ // // basic_string& -// replace(size_type pos, size_type n1, const charT* s); +// replace(size_type pos, size_type n1, const charT* s); // constexpr since C++20 #include #include @@ -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_pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp @@ -9,7 +9,7 @@ // // basic_string& -// replace(size_type pos, size_type n1, const charT* s, size_type n2); +// replace(size_type pos, size_type n1, const charT* s, size_type n2); // constexpr since C++20 #include #include @@ -37,7 +37,7 @@ assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -1337,18 +1337,18 @@ test11(); #if TEST_STD_VER > 17 - // static_assert(test0()); - // static_assert(test1()); - // static_assert(test2()); - // static_assert(test3()); - // static_assert(test4()); - // static_assert(test5()); - // static_assert(test6()); - // static_assert(test7()); - // static_assert(test8()); - // static_assert(test9()); - // static_assert(test10()); - // static_assert(test11()); + static_assert(test0()); + static_assert(test1()); + static_assert(test2()); + static_assert(test3()); + static_assert(test4()); + static_assert(test5()); + static_assert(test6()); + static_assert(test7()); + static_assert(test8()); + static_assert(test9()); + static_assert(test10()); + static_assert(test11()); #endif } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp --- 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 @@ -9,7 +9,7 @@ // // basic_string& -// replace(size_type pos, size_type n1, size_type n2, charT c); +// replace(size_type pos, size_type n1, size_type n2, charT c); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // basic_string& -// replace(size_type pos1, size_type n1, const basic_string& str); +// replace(size_type pos1, size_type n1, const basic_string& str); // constexpr since C++20 #include #include @@ -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_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp @@ -10,7 +10,7 @@ // basic_string& // replace(size_type pos1, size_type n1, const basic_string& str, -// size_type pos2, size_type n2=npos); +// size_type pos2, size_type n2=npos); // constexpr since C++20 // the "=npos" was added in C++14 #include @@ -39,7 +39,7 @@ assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -73,7 +73,7 @@ assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -6031,62 +6031,62 @@ test55(); #if TEST_STD_VER > 17 - // static_assert(test0()); - // static_assert(test1()); - // static_assert(test2()); - // static_assert(test3()); - // static_assert(test4()); - // static_assert(test5()); - // static_assert(test6()); - // static_assert(test7()); - // static_assert(test8()); - // static_assert(test9()); - // static_assert(test10()); - // static_assert(test11()); - // static_assert(test12()); - // static_assert(test13()); - // static_assert(test14()); - // static_assert(test15()); - // static_assert(test16()); - // static_assert(test17()); - // static_assert(test18()); - // static_assert(test19()); - // static_assert(test20()); - // static_assert(test21()); - // static_assert(test22()); - // static_assert(test23()); - // static_assert(test24()); - // static_assert(test25()); - // static_assert(test26()); - // static_assert(test27()); - // static_assert(test28()); - // static_assert(test29()); - // static_assert(test30()); - // static_assert(test31()); - // static_assert(test32()); - // static_assert(test33()); - // static_assert(test34()); - // static_assert(test35()); - // static_assert(test36()); - // static_assert(test37()); - // static_assert(test38()); - // static_assert(test39()); - // static_assert(test40()); - // static_assert(test41()); - // static_assert(test42()); - // static_assert(test43()); - // static_assert(test44()); - // static_assert(test45()); - // static_assert(test46()); - // static_assert(test47()); - // static_assert(test48()); - // static_assert(test49()); - // static_assert(test50()); - // static_assert(test51()); - // static_assert(test52()); - // static_assert(test53()); - // static_assert(test54()); - // static_assert(test55()); + static_assert(test0()); + static_assert(test1()); + static_assert(test2()); + static_assert(test3()); + static_assert(test4()); + static_assert(test5()); + static_assert(test6()); + static_assert(test7()); + static_assert(test8()); + static_assert(test9()); + static_assert(test10()); + static_assert(test11()); + static_assert(test12()); + static_assert(test13()); + static_assert(test14()); + static_assert(test15()); + static_assert(test16()); + static_assert(test17()); + static_assert(test18()); + static_assert(test19()); + static_assert(test20()); + static_assert(test21()); + static_assert(test22()); + static_assert(test23()); + static_assert(test24()); + static_assert(test25()); + static_assert(test26()); + static_assert(test27()); + static_assert(test28()); + static_assert(test29()); + static_assert(test30()); + static_assert(test31()); + static_assert(test32()); + static_assert(test33()); + static_assert(test34()); + static_assert(test35()); + static_assert(test36()); + static_assert(test37()); + static_assert(test38()); + static_assert(test39()); + static_assert(test40()); + static_assert(test41()); + static_assert(test42()); + static_assert(test43()); + static_assert(test44()); + static_assert(test45()); + static_assert(test46()); + static_assert(test47()); + static_assert(test48()); + static_assert(test49()); + static_assert(test50()); + static_assert(test51()); + static_assert(test52()); + static_assert(test53()); + static_assert(test54()); + static_assert(test55()); #endif } diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp --- 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 @@ -9,7 +9,7 @@ // // basic_string& -// replace(size_type pos1, size_type n1, basic_string_view sv); +// replace(size_type pos1, size_type n1, basic_string_view sv); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// void swap(basic_string& s); +// void swap(basic_string& s); // constexpr since C++20 #include #include @@ -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 @@ -10,7 +10,7 @@ // template // void swap(basic_string& lhs, -// basic_string& rhs); +// basic_string& rhs); // constexpr since C++20 #include #include @@ -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.special/swap_noexcept.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp @@ -12,11 +12,11 @@ // void swap(basic_string& c) // noexcept(!allocator_type::propagate_on_container_swap::value || -// __is_nothrow_swappable::value); +// __is_nothrow_swappable::value); // constexpr since C++20 // // In C++17, the standard says that swap shall have: // noexcept(allocator_traits::propagate_on_container_swap::value || -// allocator_traits::is_always_equal::value); +// allocator_traits::is_always_equal::value); // constexpr since C++20 // This tests a conforming extension diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp --- 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 @@ -9,7 +9,7 @@ // // template -// bool operator!=(const charT* lhs, const basic_string& rhs); +// bool operator!=(const charT* lhs, const basic_string& rhs); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // template -// bool operator!=(const basic_string& lhs, const charT* rhs); +// bool operator!=(const basic_string& lhs, const charT* rhs); // constexpr since C++20 #include #include @@ -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 @@ -10,7 +10,7 @@ // template // bool operator!=(const basic_string& lhs, -// const basic_string& rhs); +// const basic_string& rhs); // constexpr since C++20 #include #include @@ -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; @@ -190,9 +190,9 @@ test(); #endif #if TEST_STD_VER > 17 - // static_assert(test()); + static_assert(test()); #ifndef TEST_HAS_NO_WIDE_CHARACTERS - // static_assert(test()); + static_assert(test()); #endif #endif diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp --- 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 @@ -10,11 +10,11 @@ // template // basic_string -// operator+(charT lhs, const basic_string& rhs); +// operator+(charT lhs, const basic_string& rhs); // constexpr since C++20 // template // basic_string&& -// operator+(charT lhs, basic_string&& rhs); +// operator+(charT lhs, basic_string&& rhs); // constexpr since C++20 #include #include @@ -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 @@ -10,11 +10,11 @@ // template // basic_string -// operator+(const charT* lhs, const basic_string& rhs); +// operator+(const charT* lhs, const basic_string& rhs); // constexpr since C++20 // template // basic_string&& -// operator+(const charT* lhs, basic_string&& rhs); +// operator+(const charT* lhs, basic_string&& rhs); // constexpr since C++20 #include #include @@ -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 @@ -10,11 +10,11 @@ // template // basic_string -// operator+(const basic_string& lhs, charT rhs); +// operator+(const basic_string& lhs, charT rhs); // constexpr since C++20 // template // basic_string&& -// operator+(basic_string&& lhs, charT rhs); +// operator+(basic_string&& lhs, charT rhs); // constexpr since C++20 #include #include @@ -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 @@ -10,11 +10,11 @@ // template // basic_string -// operator+(const basic_string& lhs, const charT* rhs); +// operator+(const basic_string& lhs, const charT* rhs); // constexpr since C++20 // template // basic_string&& -// operator+(basic_string&& lhs, const charT* rhs); +// operator+(basic_string&& lhs, const charT* rhs); // constexpr since C++20 #include #include @@ -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 @@ -11,22 +11,22 @@ // template // basic_string // operator+(const basic_string& lhs, -// const basic_string& rhs); +// const basic_string& rhs); // constexpr since C++20 // template // basic_string&& // operator+(const basic_string&& lhs, -// const basic_string& rhs); +// const basic_string& rhs); // constexpr since C++20 // template // basic_string&& // operator+(const basic_string& lhs, -// const basic_string&& rhs); +// const basic_string&& rhs); // constexpr since C++20 // template // basic_string&& // operator+(const basic_string&& lhs, -// const basic_string&& rhs); +// const basic_string&& rhs); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // template -// bool operator==(const charT* lhs, const basic_string& rhs); +// bool operator==(const charT* lhs, const basic_string& rhs); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // template -// bool operator==(const basic_string& lhs, const charT* rhs); +// bool operator==(const basic_string& lhs, const charT* rhs); // constexpr since C++20 #include #include @@ -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 @@ -10,7 +10,7 @@ // template // bool operator==(const basic_string& lhs, -// const basic_string& rhs); +// const basic_string& rhs); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // template -// bool operator>(const charT* lhs, const basic_string& rhs); +// bool operator>(const charT* lhs, const basic_string& rhs); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // template -// bool operator>(const basic_string& lhs, const charT* rhs); +// bool operator>(const basic_string& lhs, const charT* rhs); // constexpr since C++20 #include #include @@ -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 @@ -10,7 +10,7 @@ // template // bool operator>(const basic_string& lhs, -// const basic_string& rhs); +// const basic_string& rhs); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // template -// bool operator>=(const charT* lhs, const basic_string& rhs); +// bool operator>=(const charT* lhs, const basic_string& rhs); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // template -// bool operator>=(const basic_string& lhs, const charT* rhs); +// bool operator>=(const basic_string& lhs, const charT* rhs); // constexpr since C++20 #include #include @@ -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 @@ -10,7 +10,7 @@ // template // bool operator>=(const basic_string& lhs, -// const basic_string& rhs); +// const basic_string& rhs); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // template -// bool operator<(const charT* lhs, const basic_string& rhs); +// bool operator<(const charT* lhs, const basic_string& rhs); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // template -// bool operator<(const basic_string& lhs, const charT* rhs); +// bool operator<(const basic_string& lhs, const charT* rhs); // constexpr since C++20 #include #include @@ -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 @@ -10,7 +10,7 @@ // template // bool operator<(const basic_string& lhs, -// const basic_string& rhs); +// const basic_string& rhs); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // template -// bool operator<=(const charT* lhs, const basic_string& rhs); +// bool operator<=(const charT* lhs, const basic_string& rhs); // constexpr since C++20 #include #include @@ -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 @@ -9,7 +9,7 @@ // // template -// bool operator<=(const basic_string& lhs, const charT* rhs); +// bool operator<=(const basic_string& lhs, const charT* rhs); // constexpr since C++20 #include #include @@ -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 @@ -10,7 +10,7 @@ // template // bool operator<=(const basic_string& lhs, -// const basic_string& rhs); +// const basic_string& rhs); // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// const charT* c_str() const; +// const charT* c_str() const; // constexpr since C++20 #include #include @@ -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 @@ -8,8 +8,8 @@ // -// const charT* data() const; -// charT* data(); // C++17 +// const charT* data() const; // constexpr since C++20 +// charT* data(); // C++17, constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// allocator_type get_allocator() const; +// allocator_type get_allocator() const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// int compare(const charT *s) const; +// int compare(const charT *s) const; // constexpr since C++20 #include #include @@ -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_T_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp @@ -10,7 +10,7 @@ // template // int compare(size_type pos1, size_type n1, const T& t, -// size_type pos2, size_type n2=npos) const; +// size_type pos2, size_type n2=npos) const; // constexpr since C++20 // // Mostly we're testing string_view here @@ -22,7 +22,7 @@ #include "test_macros.h" -int sign(int x) +TEST_CONSTEXPR_CXX20 int sign(int x) { if (x == 0) return 0; @@ -32,7 +32,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test(const S& s, typename S::size_type pos1, typename S::size_type n1, SV sv, typename S::size_type pos2, typename S::size_type n2, int x) { @@ -40,7 +40,7 @@ if (pos1 <= s.size() && pos2 <= sv.size()) assert(sign(s.compare(pos1, n1, sv, pos2, n2)) == sign(x)); #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -56,7 +56,7 @@ } template -void +TEST_CONSTEXPR_CXX20 void test_npos(const S& s, typename S::size_type pos1, typename S::size_type n1, SV sv, typename S::size_type pos2, int x) { @@ -64,7 +64,7 @@ if (pos1 <= s.size() && pos2 <= sv.size()) assert(sign(s.compare(pos1, n1, sv, pos2)) == sign(x)); #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -5952,155 +5952,161 @@ return true; } -int main(int, char**) -{ - { - typedef std::string S; - typedef std::string_view SV; - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); - test11(); - test12(); - test13(); - test14(); - test15(); - test16(); - test17(); - test18(); - test19(); - test20(); - test21(); - test22(); - test23(); - test24(); - test25(); - test26(); - test27(); - test28(); - test29(); - test30(); - test31(); - test32(); - test33(); - test34(); - test35(); - test36(); - test37(); - test38(); - test39(); - test40(); - test41(); - test42(); - test43(); - test44(); - test45(); - test46(); - test47(); - test48(); - test49(); - test50(); - test51(); - test52(); - test53(); - test54(); - test55(); - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; - typedef std::basic_string_view> SV; - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); - test11(); - test12(); - test13(); - test14(); - test15(); - test16(); - test17(); - test18(); - test19(); - test20(); - test21(); - test22(); - test23(); - test24(); - test25(); - test26(); - test27(); - test28(); - test29(); - test30(); - test31(); - test32(); - test33(); - test34(); - test35(); - test36(); - test37(); - test38(); - test39(); - test40(); - test41(); - test42(); - test43(); - test44(); - test45(); - test46(); - test47(); - test48(); - test49(); - test50(); - test51(); - test52(); - test53(); - test54(); - test55(); - } -#endif - { - typedef std::string S; - typedef std::string_view SV; - S s = "MNOP"; - SV sv = "CDEF"; - char arr[] = "MNOP"; +template +TEST_CONSTEXPR_CXX20 bool test56() { + S s = "MNOP"; + SV sv = "CDEF"; + char arr[] = "MNOP"; // calls compare(pos, n1, const char *, 0) - assert(s.compare(0, 4, "QRST", 0) > 0); + assert(s.compare(0, 4, "QRST", 0) > 0); // calls compare(pos, n1, string("QRST"), 0, npos) - assert(s.compare(0, 4, "QRST", 0, std::string::npos) < 0); + assert(s.compare(0, 4, "QRST", 0, std::string::npos) < 0); // calls compare(pos, n1, T, 0, npos) - assert(s.compare(0, 4, sv, 0) > 0); + assert(s.compare(0, 4, sv, 0) > 0); // calls compare(pos, n1, T, 0, npos) - assert(s.compare(0, 4, sv, 0, std::string::npos) > 0); + assert(s.compare(0, 4, sv, 0, std::string::npos) > 0); // calls compare(pos, n1, const char *, 0) - assert(s.compare(0, 4, arr, 0) > 0); + assert(s.compare(0, 4, arr, 0) > 0); // calls compare(size, size, string(arr), 0, npos) - assert(s.compare(0, 4, arr, 0, std::string::npos) == 0); - } + assert(s.compare(0, 4, arr, 0, std::string::npos) == 0); + + return true; +} + +template +void test() { + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + test9(); + test10(); + test11(); + test12(); + test13(); + test14(); + test15(); + test16(); + test17(); + test18(); + test19(); + test20(); + test21(); + test22(); + test23(); + test24(); + test25(); + test26(); + test27(); + test28(); + test29(); + test30(); + test31(); + test32(); + test33(); + test34(); + test35(); + test36(); + test37(); + test38(); + test39(); + test40(); + test41(); + test42(); + test43(); + test44(); + test45(); + test46(); + test47(); + test48(); + test49(); + test50(); + test51(); + test52(); + test53(); + test54(); + test55(); + test56(); + +#if TEST_STD_VER > 17 + static_assert(test0()); + static_assert(test1()); + static_assert(test2()); + static_assert(test3()); + static_assert(test4()); + static_assert(test5()); + static_assert(test6()); + static_assert(test7()); + static_assert(test8()); + static_assert(test9()); + static_assert(test10()); + static_assert(test11()); + static_assert(test12()); + static_assert(test13()); + static_assert(test14()); + static_assert(test15()); + static_assert(test16()); + static_assert(test17()); + static_assert(test18()); + static_assert(test19()); + static_assert(test20()); + static_assert(test21()); + static_assert(test22()); + static_assert(test23()); + static_assert(test24()); + static_assert(test25()); + static_assert(test26()); + static_assert(test27()); + static_assert(test28()); + static_assert(test29()); + static_assert(test30()); + static_assert(test31()); + static_assert(test32()); + static_assert(test33()); + static_assert(test34()); + static_assert(test35()); + static_assert(test36()); + static_assert(test37()); + static_assert(test38()); + static_assert(test39()); + static_assert(test40()); + static_assert(test41()); + static_assert(test42()); + static_assert(test43()); + static_assert(test44()); + static_assert(test45()); + static_assert(test46()); + static_assert(test47()); + static_assert(test48()); + static_assert(test49()); + static_assert(test50()); + static_assert(test51()); + static_assert(test52()); + static_assert(test53()); + static_assert(test54()); + static_assert(test55()); + static_assert(test56()); +#endif +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER >= 11 + test, min_allocator>, + std::basic_string_view>>(); +#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 @@ -8,7 +8,7 @@ // -// int compare(size_type pos, size_type n1, const charT *s) const; +// int compare(size_type pos, size_type n1, const charT *s) const; // constexpr since C++20 #include #include @@ -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_pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp @@ -8,7 +8,7 @@ // -// int compare(size_type pos, size_type n1, const charT *s, size_type n2) const; +// int compare(size_type pos, size_type n1, const charT *s, size_type n2) const; // constexpr since C++20 #include #include @@ -35,7 +35,7 @@ if (pos <= s.size()) assert(sign(s.compare(pos, n1, str, n2)) == sign(x)); #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -1333,18 +1333,20 @@ test10(); test11(); - // static_assert(test0()); - // static_assert(test1()); - // static_assert(test2()); - // static_assert(test3()); - // static_assert(test4()); - // static_assert(test5()); - // static_assert(test6()); - // static_assert(test7()); - // static_assert(test8()); - // static_assert(test9()); - // static_assert(test10()); - // static_assert(test11()); +#if TEST_STD_VER > 17 + static_assert(test0()); + static_assert(test1()); + static_assert(test2()); + static_assert(test3()); + static_assert(test4()); + static_assert(test5()); + static_assert(test6()); + static_assert(test7()); + static_assert(test8()); + static_assert(test9()); + static_assert(test10()); + static_assert(test11()); +#endif } int main(int, char**) diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp --- 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 @@ -8,7 +8,7 @@ // -// int compare(size_type pos1, size_type n1, const basic_string& str) const; +// int compare(size_type pos1, size_type n1, const basic_string& str) const; // constexpr since C++20 #include #include @@ -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_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp @@ -9,7 +9,7 @@ // // int compare(size_type pos1, size_type n1, const basic_string& str, -// size_type pos2, size_type n2=npos) const; +// size_type pos2, size_type n2=npos) const; // constexpr since C++20 // the "=npos" was added in C++14 #include @@ -37,7 +37,7 @@ if (pos1 <= s.size() && pos2 <= str.size()) assert(sign(s.compare(pos1, n1, str, pos2, n2)) == sign(x)); #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -53,14 +53,14 @@ } template -void +TEST_CONSTEXPR_CXX20 void test_npos(const S& s, typename S::size_type pos1, typename S::size_type n1, const S& str, typename S::size_type pos2, int x) { if (pos1 <= s.size() && pos2 <= str.size()) assert(sign(s.compare(pos1, n1, str, pos2)) == sign(x)); #ifndef TEST_HAS_NO_EXCEPTIONS - else + else if (!TEST_IS_CONSTANT_EVALUATED) { try { @@ -6007,62 +6007,64 @@ test54(); test55(); - // static_assert(test0()); - // static_assert(test1()); - // static_assert(test2()); - // static_assert(test3()); - // static_assert(test4()); - // static_assert(test5()); - // static_assert(test6()); - // static_assert(test7()); - // static_assert(test8()); - // static_assert(test9()); - // static_assert(test10()); - // static_assert(test11()); - // static_assert(test12()); - // static_assert(test13()); - // static_assert(test14()); - // static_assert(test15()); - // static_assert(test16()); - // static_assert(test17()); - // static_assert(test18()); - // static_assert(test19()); - // static_assert(test20()); - // static_assert(test21()); - // static_assert(test22()); - // static_assert(test23()); - // static_assert(test24()); - // static_assert(test25()); - // static_assert(test26()); - // static_assert(test27()); - // static_assert(test28()); - // static_assert(test29()); - // static_assert(test30()); - // static_assert(test31()); - // static_assert(test32()); - // static_assert(test33()); - // static_assert(test34()); - // static_assert(test35()); - // static_assert(test36()); - // static_assert(test37()); - // static_assert(test38()); - // static_assert(test39()); - // static_assert(test40()); - // static_assert(test41()); - // static_assert(test42()); - // static_assert(test43()); - // static_assert(test44()); - // static_assert(test45()); - // static_assert(test46()); - // static_assert(test47()); - // static_assert(test48()); - // static_assert(test49()); - // static_assert(test50()); - // static_assert(test51()); - // static_assert(test52()); - // static_assert(test53()); - // static_assert(test54()); - // static_assert(test55()); +#if TEST_STD_VER > 17 + static_assert(test0()); + static_assert(test1()); + static_assert(test2()); + static_assert(test3()); + static_assert(test4()); + static_assert(test5()); + static_assert(test6()); + static_assert(test7()); + static_assert(test8()); + static_assert(test9()); + static_assert(test10()); + static_assert(test11()); + static_assert(test12()); + static_assert(test13()); + static_assert(test14()); + static_assert(test15()); + static_assert(test16()); + static_assert(test17()); + static_assert(test18()); + static_assert(test19()); + static_assert(test20()); + static_assert(test21()); + static_assert(test22()); + static_assert(test23()); + static_assert(test24()); + static_assert(test25()); + static_assert(test26()); + static_assert(test27()); + static_assert(test28()); + static_assert(test29()); + static_assert(test30()); + static_assert(test31()); + static_assert(test32()); + static_assert(test33()); + static_assert(test34()); + static_assert(test35()); + static_assert(test36()); + static_assert(test37()); + static_assert(test38()); + static_assert(test39()); + static_assert(test40()); + static_assert(test41()); + static_assert(test42()); + static_assert(test43()); + static_assert(test44()); + static_assert(test45()); + static_assert(test46()); + static_assert(test47()); + static_assert(test48()); + static_assert(test49()); + static_assert(test50()); + static_assert(test51()); + static_assert(test52()); + static_assert(test53()); + static_assert(test54()); + static_assert(test55()); +#endif } int main(int, char**) diff --git a/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp --- 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 @@ -8,7 +8,7 @@ // -// int compare(size_type pos1, size_type n1, basic_string_view sv) const; +// int compare(size_type pos1, size_type n1, basic_string_view sv) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// int compare(const basic_string& str) const +// int compare(const basic_string& str) const // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// int compare(const basic_string_view sv) const +// int compare(const basic_string_view sv) const // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_first_not_of(charT c, size_type pos = 0) const; +// size_type find_first_not_of(charT c, size_type pos = 0) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_first_not_of(const charT* s, size_type pos = 0) const; +// size_type find_first_not_of(const charT* s, size_type pos = 0) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_first_not_of(const charT* s, size_type pos, size_type n) const; +// size_type find_first_not_of(const charT* s, size_type pos, size_type n) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_first_not_of(const basic_string& str, size_type pos = 0) const; +// size_type find_first_not_of(const basic_string& str, size_type pos = 0) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_first_not_of(basic_string_view sv, size_type pos = 0) const; +// size_type find_first_not_of(basic_string_view sv, size_type pos = 0) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_first_of(charT c, size_type pos = 0) const; +// size_type find_first_of(charT c, size_type pos = 0) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_first_of(const charT* s, size_type pos = 0) const; +// size_type find_first_of(const charT* s, size_type pos = 0) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_first_of(const charT* s, size_type pos, size_type n) const; +// size_type find_first_of(const charT* s, size_type pos, size_type n) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_first_of(const basic_string& str, size_type pos = 0) const; +// size_type find_first_of(const basic_string& str, size_type pos = 0) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_first_of(const basic_string_view sv, size_type pos = 0) const; +// size_type find_first_of(const basic_string_view sv, size_type pos = 0) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_last_not_of(charT c, size_type pos = npos) const; +// size_type find_last_not_of(charT c, size_type pos = npos) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_last_not_of(const charT* s, size_type pos = npos) const; +// size_type find_last_not_of(const charT* s, size_type pos = npos) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_last_not_of(const charT* s, size_type pos, size_type n) const; +// size_type find_last_not_of(const charT* s, size_type pos, size_type n) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_last_not_of(const basic_string& str, size_type pos = npos) const; +// size_type find_last_not_of(const basic_string& str, size_type pos = npos) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_last_not_of(basic_string_view sv, size_type pos = npos) const; +// size_type find_last_not_of(basic_string_view sv, size_type pos = npos) const; // constexpr since C++20 #include #include @@ -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; @@ -151,10 +151,10 @@ } #if TEST_STD_VER >= 11 { -// typedef std::basic_string, min_allocator> S; -// typedef std::string_view SV; -// test0(); -// test1(); + typedef std::basic_string, min_allocator> S; + typedef std::string_view SV; + test0(); + test1(); } #endif @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_last_of(charT c, size_type pos = npos) const; +// size_type find_last_of(charT c, size_type pos = npos) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_last_of(const charT* s, size_type pos = npos) const; +// size_type find_last_of(const charT* s, size_type pos = npos) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_last_of(const charT* s, size_type pos, size_type n) const; +// size_type find_last_of(const charT* s, size_type pos, size_type n) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_last_of(const basic_string& str, size_type pos = npos) const; +// size_type find_last_of(const basic_string& str, size_type pos = npos) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find_last_of(const basic_string_view sv, size_type pos = npos) const; +// size_type find_last_of(const basic_string_view sv, size_type pos = npos) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find(charT c, size_type pos = 0) const; +// size_type find(charT c, size_type pos = 0) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find(const charT* s, size_type pos = 0) const; +// size_type find(const charT* s, size_type pos = 0) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find(const charT* s, size_type pos, size_type n) const; +// size_type find(const charT* s, size_type pos, size_type n) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find(const basic_string& str, size_type pos = 0) const; +// size_type find(const basic_string& str, size_type pos = 0) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type find(basic_string_view sv, size_type pos = 0) const; +// size_type find(basic_string_view sv, size_type pos = 0) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type rfind(charT c, size_type pos = npos) const; +// size_type rfind(charT c, size_type pos = npos) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type rfind(const charT* s, size_type pos = npos) const; +// size_type rfind(const charT* s, size_type pos = npos) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type rfind(const charT* s, size_type pos, size_type n) const; +// size_type rfind(const charT* s, size_type pos, size_type n) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type rfind(const basic_string& str, size_type pos = npos) const; +// size_type rfind(const basic_string& str, size_type pos = npos) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// size_type rfind(basic_string_view sv, size_type pos = npos) const; +// size_type rfind(basic_string_view sv, size_type pos = npos) const; // constexpr since C++20 #include #include @@ -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 @@ -8,7 +8,7 @@ // -// basic_string substr(size_type pos = 0, size_type n = npos) const; +// basic_string substr(size_type pos = 0, size_type n = npos) const; // constexpr since C++20 #include #include @@ -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 @@ -9,14 +9,14 @@ // -// bool starts_with(charT x) const noexcept; +// constexpr bool starts_with(charT x) const noexcept; #include #include #include "test_macros.h" -bool test() { +constexpr bool test() { { typedef std::string S; S s1 {}; @@ -36,9 +36,7 @@ int main(int, char**) { test(); -#if TEST_STD_VER > 17 - // static_assert(test()); -#endif + static_assert(test()); return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.ptr.pass.cpp b/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.ptr.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.ptr.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.ptr.pass.cpp @@ -9,14 +9,14 @@ // -// bool starts_with(const CharT *x) const; +// constexpr bool starts_with(const CharT *x) const; #include #include #include "test_macros.h" -bool test() { +constexpr bool test() { { typedef std::string S; const char *s = "abcde"; @@ -64,9 +64,7 @@ int main(int, char**) { test(); -#if TEST_STD_VER > 17 - // static_assert(test()); -#endif + static_assert(test()); return 0; } diff --git a/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.string_view.pass.cpp --- a/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.string_view.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.starts_with/starts_with.string_view.pass.cpp @@ -9,14 +9,14 @@ // -// bool starts_with(string_view x) const noexcept; +// constexpr bool starts_with(string_view x) const noexcept; #include #include #include "test_macros.h" -bool test() { +constexpr bool test() { typedef std::string S; typedef std::string_view SV; const char *s = "abcde"; @@ -72,9 +72,7 @@ int main(int, char**) { test(); -#if TEST_STD_VER > 17 - // static_assert(test()); -#endif + static_assert(test()); return 0; } diff --git a/libcxx/test/support/constexpr_char_traits.h b/libcxx/test/support/constexpr_char_traits.h --- 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) // fails in constexpr because we might be comparing unrelated pointers + assert(__s2 < __s1 || __s2 >= __s1+__n); char_type* __r = __s1; for (; __n; --__n, ++__s1, ++__s2) assign(*__s1, *__s2); diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -248,7 +248,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",