diff --git a/libcxx/docs/Cxx2aStatusPaperStatus.csv b/libcxx/docs/Cxx2aStatusPaperStatus.csv --- a/libcxx/docs/Cxx2aStatusPaperStatus.csv +++ b/libcxx/docs/Cxx2aStatusPaperStatus.csv @@ -68,7 +68,7 @@ "`P1006R1 `__","LWG","Constexpr in std::pointer_traits","San Diego","|Complete|","8.0" "`P1007R3 `__","LWG","``std::assume_aligned``\ ","San Diego","* *","" "`P1020R1 `__","LWG","Smart pointer creation with default initialization","San Diego","* *","" -"`P1032R1 `__","LWG","Misc constexpr bits","San Diego","* *","" +"`P1032R1 `__","LWG","Misc constexpr bits","San Diego","|Complete|","13.0" "`P1085R2 `__","LWG","Should Span be Regular?","San Diego","|Complete|","8.0" "`P1123R0 `__","LWG","Editorial Guidance for merging P0019r8 and P0528r3","San Diego","* *","" "`P1148R0 `__","LWG","Cleaning up Clause 20","San Diego","* *","" diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst --- a/libcxx/docs/FeatureTestMacroTable.rst +++ b/libcxx/docs/FeatureTestMacroTable.rst @@ -208,17 +208,17 @@ ------------------------------------------------- ----------------- ``__cpp_lib_constexpr_functional`` ``201907L`` ------------------------------------------------- ----------------- - ``__cpp_lib_constexpr_iterator`` *unimplemented* + ``__cpp_lib_constexpr_iterator`` ``201811L`` ------------------------------------------------- ----------------- ``__cpp_lib_constexpr_memory`` ``201811L`` ------------------------------------------------- ----------------- ``__cpp_lib_constexpr_numeric`` ``201911L`` ------------------------------------------------- ----------------- - ``__cpp_lib_constexpr_string`` *unimplemented* + ``__cpp_lib_constexpr_string`` ``201811L`` ------------------------------------------------- ----------------- - ``__cpp_lib_constexpr_string_view`` *unimplemented* + ``__cpp_lib_constexpr_string_view`` ``201811L`` ------------------------------------------------- ----------------- - ``__cpp_lib_constexpr_tuple`` *unimplemented* + ``__cpp_lib_constexpr_tuple`` ``201811L`` ------------------------------------------------- ----------------- ``__cpp_lib_constexpr_utility`` ``201811L`` ------------------------------------------------- ----------------- diff --git a/libcxx/include/iterator b/libcxx/include/iterator --- a/libcxx/include/iterator +++ b/libcxx/include/iterator @@ -152,14 +152,14 @@ typedef void reference; typedef void pointer; - explicit back_insert_iterator(Container& x); - back_insert_iterator& operator=(const typename Container::value_type& value); - back_insert_iterator& operator*(); - back_insert_iterator& operator++(); - back_insert_iterator operator++(int); + explicit back_insert_iterator(Container& x); // constexpr in C++20 + back_insert_iterator& operator=(const typename Container::value_type& value); // constexpr in C++20 + back_insert_iterator& operator*(); // constexpr in C++20 + back_insert_iterator& operator++(); // constexpr in C++20 + back_insert_iterator operator++(int); // constexpr in C++20 }; -template back_insert_iterator back_inserter(Container& x); +template back_insert_iterator back_inserter(Container& x); // constexpr in C++20 template class front_insert_iterator @@ -173,14 +173,14 @@ typedef void reference; typedef void pointer; - explicit front_insert_iterator(Container& x); - front_insert_iterator& operator=(const typename Container::value_type& value); - front_insert_iterator& operator*(); - front_insert_iterator& operator++(); - front_insert_iterator operator++(int); + explicit front_insert_iterator(Container& x); // constexpr in C++20 + front_insert_iterator& operator=(const typename Container::value_type& value); // constexpr in C++20 + front_insert_iterator& operator*(); // constexpr in C++20 + front_insert_iterator& operator++(); // constexpr in C++20 + front_insert_iterator operator++(int); // constexpr in C++20 }; -template front_insert_iterator front_inserter(Container& x); +template front_insert_iterator front_inserter(Container& x); // constexpr in C++20 template class insert_iterator @@ -195,15 +195,15 @@ typedef void reference; typedef void pointer; - insert_iterator(Container& x, typename Container::iterator i); - insert_iterator& operator=(const typename Container::value_type& value); - insert_iterator& operator*(); - insert_iterator& operator++(); - insert_iterator& operator++(int); + insert_iterator(Container& x, typename Container::iterator i); // constexpr in C++20 + insert_iterator& operator=(const typename Container::value_type& value); // constexpr in C++20 + insert_iterator& operator*(); // constexpr in C++20 + insert_iterator& operator++(); // constexpr in C++20 + insert_iterator& operator++(int); // constexpr in C++20 }; template -insert_iterator inserter(Container& x, Iterator i); +insert_iterator inserter(Container& x, Iterator i); // constexpr in C++20 template class move_iterator { @@ -932,20 +932,20 @@ public: typedef _Container container_type; - _LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} - _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value_) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit back_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 back_insert_iterator& operator=(const typename _Container::value_type& __value_) {container->push_back(__value_); return *this;} #ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value_) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 back_insert_iterator& operator=(typename _Container::value_type&& __value_) {container->push_back(_VSTD::move(__value_)); return *this;} #endif // _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*() {return *this;} - _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++() {return *this;} - _LIBCPP_INLINE_VISIBILITY back_insert_iterator operator++(int) {return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 back_insert_iterator& operator*() {return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 back_insert_iterator& operator++() {return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 back_insert_iterator operator++(int) {return *this;} }; template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 back_insert_iterator<_Container> back_inserter(_Container& __x) { @@ -965,20 +965,20 @@ public: typedef _Container container_type; - _LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} - _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value_) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit front_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 front_insert_iterator& operator=(const typename _Container::value_type& __value_) {container->push_front(__value_); return *this;} #ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value_) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 front_insert_iterator& operator=(typename _Container::value_type&& __value_) {container->push_front(_VSTD::move(__value_)); return *this;} #endif // _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*() {return *this;} - _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++() {return *this;} - _LIBCPP_INLINE_VISIBILITY front_insert_iterator operator++(int) {return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 front_insert_iterator& operator*() {return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 front_insert_iterator& operator++() {return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 front_insert_iterator operator++(int) {return *this;} }; template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 front_insert_iterator<_Container> front_inserter(_Container& __x) { @@ -999,21 +999,21 @@ public: typedef _Container container_type; - _LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 insert_iterator(_Container& __x, typename _Container::iterator __i) : container(_VSTD::addressof(__x)), iter(__i) {} - _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value_) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 insert_iterator& operator=(const typename _Container::value_type& __value_) {iter = container->insert(iter, __value_); ++iter; return *this;} #ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value_) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 insert_iterator& operator=(typename _Container::value_type&& __value_) {iter = container->insert(iter, _VSTD::move(__value_)); ++iter; return *this;} #endif // _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;} - _LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;} - _LIBCPP_INLINE_VISIBILITY insert_iterator& operator++(int) {return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 insert_iterator& operator*() {return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 insert_iterator& operator++() {return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 insert_iterator& operator++(int) {return *this;} }; template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 insert_iterator<_Container> inserter(_Container& __x, typename _Container::iterator __i) { diff --git a/libcxx/include/string_view b/libcxx/include/string_view --- a/libcxx/include/string_view +++ b/libcxx/include/string_view @@ -107,7 +107,7 @@ constexpr void remove_suffix(size_type n); constexpr void swap(basic_string_view& s) noexcept; - 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 in C++20 constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const; constexpr int compare(basic_string_view s) const noexcept; @@ -359,7 +359,7 @@ __other.__size = __sz; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const { if (__pos > size()) diff --git a/libcxx/include/tuple b/libcxx/include/tuple --- a/libcxx/include/tuple +++ b/libcxx/include/tuple @@ -38,39 +38,39 @@ template tuple(allocator_arg_t, const Alloc& a); template - explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const T&...); + explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const T&...); // constexpr in C++20 template - explicit(see-below) tuple(allocator_arg_t, const Alloc& a, U&&...); + explicit(see-below) tuple(allocator_arg_t, const Alloc& a, U&&...); // constexpr in C++20 template - tuple(allocator_arg_t, const Alloc& a, const tuple&); + tuple(allocator_arg_t, const Alloc& a, const tuple&); // constexpr in C++20 template - tuple(allocator_arg_t, const Alloc& a, tuple&&); + tuple(allocator_arg_t, const Alloc& a, tuple&&); // constexpr in C++20 template - explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const tuple&); + explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const tuple&); // constexpr in C++20 template - explicit(see-below) tuple(allocator_arg_t, const Alloc& a, tuple&&); + explicit(see-below) tuple(allocator_arg_t, const Alloc& a, tuple&&); // constexpr in C++20 template - explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const pair&); + explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const pair&); // constexpr in C++20 template - explicit(see-below) tuple(allocator_arg_t, const Alloc& a, pair&&); + explicit(see-below) tuple(allocator_arg_t, const Alloc& a, pair&&); // constexpr in C++20 - tuple& operator=(const tuple&); - tuple& operator=(tuple&&) noexcept(is_nothrow_move_assignable_v && ...); + tuple& operator=(const tuple&); // constexpr in C++20 + tuple& operator=(tuple&&) noexcept(is_nothrow_move_assignable_v && ...); // constexpr in C++20 template - tuple& operator=(const tuple&); + tuple& operator=(const tuple&); // constexpr in C++20 template - tuple& operator=(tuple&&); + tuple& operator=(tuple&&); // constexpr in C++20 template - tuple& operator=(const pair&); // iff sizeof...(T) == 2 + tuple& operator=(const pair&); // iff sizeof...(T) == 2 // constexpr in C++20 template - tuple& operator=(pair&&); // iff sizeof...(T) == 2 + tuple& operator=(pair&&); // iff sizeof...(T) == 2 // constexpr in C++20 template tuple& operator=(array const&) // iff sizeof...(T) == N, EXTENSION template tuple& operator=(array&&) // iff sizeof...(T) == N, EXTENSION - void swap(tuple&) noexcept(AND(swap(declval(), declval())...)); + void swap(tuple&) noexcept(AND(swap(declval(), declval())...)); // constexpr in C++20 }; template @@ -174,7 +174,7 @@ class __tuple_leaf; template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y) _NOEXCEPT_(__is_nothrow_swappable<_Hp>::value) { @@ -195,29 +195,30 @@ #endif } + _LIBCPP_CONSTEXPR_AFTER_CXX11 __tuple_leaf& operator=(const __tuple_leaf&); public: - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf() + _LIBCPP_INLINE_VISIBILITY constexpr __tuple_leaf() _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : __value_() {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY constexpr __tuple_leaf(integral_constant, const _Alloc&) : __value_() {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY constexpr __tuple_leaf(integral_constant, const _Alloc& __a) : __value_(allocator_arg_t(), __a) {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY constexpr __tuple_leaf(integral_constant, const _Alloc& __a) : __value_(__a) {static_assert(!is_reference<_Hp>::value, @@ -238,21 +239,21 @@ "Attempted construction of reference element binds to a temporary whose lifetime has ended");} template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit __tuple_leaf(integral_constant, const _Alloc&, _Tp&& __t) : __value_(_VSTD::forward<_Tp>(__t)) {static_assert(__can_bind_reference<_Tp&&>(), "Attempted construction of reference element binds to a temporary whose lifetime has ended");} template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit __tuple_leaf(integral_constant, const _Alloc& __a, _Tp&& __t) : __value_(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) {static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");} template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit __tuple_leaf(integral_constant, const _Alloc& __a, _Tp&& __t) : __value_(_VSTD::forward<_Tp>(__t), __a) {static_assert(!is_reference<_Hp>::value, @@ -261,7 +262,7 @@ __tuple_leaf(const __tuple_leaf& __t) = default; __tuple_leaf(__tuple_leaf&& __t) = default; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 int swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value) { _VSTD::swap(*this, __t); @@ -276,23 +277,23 @@ class __tuple_leaf<_Ip, _Hp, true> : private _Hp { - + _LIBCPP_CONSTEXPR_AFTER_CXX11 __tuple_leaf& operator=(const __tuple_leaf&); public: - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf() + _LIBCPP_INLINE_VISIBILITY constexpr __tuple_leaf() _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) {} template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY constexpr __tuple_leaf(integral_constant, const _Alloc&) {} template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY constexpr __tuple_leaf(integral_constant, const _Alloc& __a) : _Hp(allocator_arg_t(), __a) {} template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY constexpr __tuple_leaf(integral_constant, const _Alloc& __a) : _Hp(__a) {} @@ -309,24 +310,24 @@ : _Hp(_VSTD::forward<_Tp>(__t)) {} template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY constexpr explicit __tuple_leaf(integral_constant, const _Alloc&, _Tp&& __t) : _Hp(_VSTD::forward<_Tp>(__t)) {} template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY constexpr explicit __tuple_leaf(integral_constant, const _Alloc& __a, _Tp&& __t) : _Hp(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) {} template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY constexpr explicit __tuple_leaf(integral_constant, const _Alloc& __a, _Tp&& __t) : _Hp(_VSTD::forward<_Tp>(__t), __a) {} __tuple_leaf(__tuple_leaf const &) = default; __tuple_leaf(__tuple_leaf &&) = default; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 int swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value) { @@ -339,7 +340,7 @@ }; template -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 void __swallow(_Tp&&...) _NOEXCEPT {} template @@ -359,7 +360,7 @@ : public __tuple_leaf<_Indx, _Tp>... { _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR __tuple_impl() + constexpr __tuple_impl() _NOEXCEPT_(__all::value...>::value) {} template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit __tuple_impl(allocator_arg_t, const _Alloc& __a, __tuple_indices<_Uf...>, __tuple_types<_Tf...>, @@ -407,7 +408,7 @@ __tuple_constructible<_Tuple, tuple<_Tp...> >::value >::type > - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) : __tuple_leaf<_Indx, _Tp>(__uses_alloc_ctor<_Tp, _Alloc, typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>(), __a, @@ -418,7 +419,7 @@ __tuple_impl(const __tuple_impl&) = default; __tuple_impl(__tuple_impl&&) = default; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 void swap(__tuple_impl& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) { @@ -427,13 +428,13 @@ }; template -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 void __memberwise_copy_assign(_Dest& __dest, _Source const& __source, __tuple_indices<_Np...>) { _VSTD::__swallow(((_VSTD::get<_Np>(__dest) = _VSTD::get<_Np>(__source)), void(), 0)...); } template -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 void __memberwise_forward_assign(_Dest& __dest, _Source&& __source, __tuple_types<_Up...>, __tuple_indices<_Np...>) { _VSTD::__swallow((( _VSTD::get<_Np>(__dest) = _VSTD::forward<_Up>(_VSTD::get<_Np>(__source)) @@ -619,14 +620,14 @@ template ::__enable_implicit_default() , void*> = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + _LIBCPP_INLINE_VISIBILITY constexpr tuple() _NOEXCEPT_(__all::value...>::value) {} template ::__enable_explicit_default() , void*> = nullptr> - explicit _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + explicit _LIBCPP_INLINE_VISIBILITY constexpr tuple() _NOEXCEPT_(__all::value...>::value) {} @@ -637,7 +638,7 @@ _CheckArgsConstructor<_IsSame::value >::__enable_implicit_default() , void*> = nullptr > - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple(_AllocArgT, _Alloc const& __a) : __base_(allocator_arg_t(), __a, __tuple_indices<>(), __tuple_types<>(), @@ -648,7 +649,7 @@ _CheckArgsConstructor<_IsSame::value>::__enable_explicit_default() , void*> = nullptr > - explicit _LIBCPP_INLINE_VISIBILITY + explicit _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple(_AllocArgT, _Alloc const& __a) : __base_(allocator_arg_t(), __a, __tuple_indices<>(), __tuple_types<>(), @@ -700,7 +701,7 @@ bool >::type = false > - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t) : __base_(allocator_arg_t(), __a, typename __make_tuple_indices::type(), @@ -719,7 +720,7 @@ bool >::type = false > - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t) : __base_(allocator_arg_t(), __a, @@ -806,7 +807,7 @@ bool >::type = false > - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u) : __base_(allocator_arg_t(), __a, typename __make_tuple_indices::type(), @@ -825,7 +826,7 @@ bool >::type = false > - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u) : __base_(allocator_arg_t(), __a, @@ -865,7 +866,7 @@ bool >::type = false > - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) : __base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {} @@ -878,13 +879,13 @@ bool >::type = false > - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) : __base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {} // [tuple.assign] - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple& operator=(_If<_And...>::value, tuple, __nat> const& __tuple) _NOEXCEPT_((_And...>::value)) { @@ -893,7 +894,7 @@ return *this; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple& operator=(_If<_And...>::value, tuple, __nat>&& __tuple) _NOEXCEPT_((_And...>::value)) { @@ -909,7 +910,7 @@ is_assignable<_Tp&, _Up const&>... >::value ,int> = 0> - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple& operator=(tuple<_Up...> const& __tuple) _NOEXCEPT_((_And...>::value)) { @@ -924,7 +925,7 @@ is_assignable<_Tp&, _Up>... >::value ,int> = 0> - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple& operator=(tuple<_Up...>&& __tuple) _NOEXCEPT_((_And...>::value)) { @@ -941,7 +942,7 @@ is_assignable<_SecondType<_Tp..., _Dep>&, _Up2 const&> >::value ,int> = 0> - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple& operator=(pair<_Up1, _Up2> const& __pair) _NOEXCEPT_((_And< is_nothrow_assignable<_FirstType<_Tp...>&, _Up1 const&>, @@ -960,7 +961,7 @@ is_assignable<_SecondType<_Tp..., _Dep>&, _Up2> >::value ,int> = 0> - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple& operator=(pair<_Up1, _Up2>&& __pair) _NOEXCEPT_((_And< is_nothrow_assignable<_FirstType<_Tp...>&, _Up1>, @@ -979,7 +980,7 @@ is_assignable<_Tp&, _Up const&>... >::value > > - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple& operator=(array<_Up, _Np> const& __array) _NOEXCEPT_((_And...>::value)) { @@ -995,7 +996,7 @@ is_assignable<_Tp&, _Up>... >::value > > - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple& operator=(array<_Up, _Np>&& __array) _NOEXCEPT_((_And...>::value)) { @@ -1006,7 +1007,7 @@ } // [tuple.swap] - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void swap(tuple& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {__base_.swap(__t.__base_);} }; @@ -1015,21 +1016,21 @@ class _LIBCPP_TEMPLATE_VIS tuple<> { public: - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR tuple() _NOEXCEPT = default; + _LIBCPP_INLINE_VISIBILITY constexpr + tuple() _NOEXCEPT = default; template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {} template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple(allocator_arg_t, const _Alloc&, const tuple&) _NOEXCEPT {} template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple(array<_Up, 0>) _NOEXCEPT {} template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) _NOEXCEPT {} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void swap(tuple&) _NOEXCEPT {} }; @@ -1047,7 +1048,7 @@ #endif template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if < __all<__is_swappable<_Tp>::value...>::value, diff --git a/libcxx/include/utility b/libcxx/include/utility --- a/libcxx/include/utility +++ b/libcxx/include/utility @@ -76,15 +76,15 @@ template explicit(see-below) pair(pair&& p); // constexpr in C++14 template pair(piecewise_construct_t, tuple first_args, - tuple second_args); + tuple second_args); // constexpr in C++20 - template pair& operator=(const pair& p); + template pair& operator=(const pair& p); // constexpr in C++20 pair& operator=(pair&& p) noexcept(is_nothrow_move_assignable::value && - is_nothrow_move_assignable::value); - template pair& operator=(pair&& p); + is_nothrow_move_assignable::value); // constexpr in C++20 + template pair& operator=(pair&& p); // constexpr in C++20 void swap(pair& p) noexcept(is_nothrow_swappable_v && - is_nothrow_swappable_v); + is_nothrow_swappable_v); // constexpr in C++20 }; template bool operator==(const pair&, const pair&); // constexpr in C++14 @@ -94,10 +94,10 @@ template bool operator>=(const pair&, const pair&); // constexpr in C++14 template bool operator<=(const pair&, const pair&); // constexpr in C++14 -template pair make_pair(T1&&, T2&&); // constexpr in C++14 +template pair make_pair(T1&&, T2&&); // constexpr in C++14 template void -swap(pair& x, pair& y) noexcept(noexcept(x.swap(y))); +swap(pair& x, pair& y) noexcept(noexcept(x.swap(y))); // constexpr in C++20 struct piecewise_construct_t { explicit piecewise_construct_t() = default; }; inline constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); diff --git a/libcxx/include/version b/libcxx/include/version --- a/libcxx/include/version +++ b/libcxx/include/version @@ -56,7 +56,7 @@ __cpp_lib_constexpr_iterator 201811L __cpp_lib_constexpr_memory 201811L __cpp_lib_constexpr_numeric 201911L -__cpp_lib_constexpr_string 201907L +__cpp_lib_constexpr_string 201811L __cpp_lib_constexpr_string_view 201811L __cpp_lib_constexpr_tuple 201811L __cpp_lib_constexpr_utility 201811L @@ -303,12 +303,12 @@ // # define __cpp_lib_constexpr_complex 201711L # define __cpp_lib_constexpr_dynamic_alloc 201907L # define __cpp_lib_constexpr_functional 201907L -// # define __cpp_lib_constexpr_iterator 201811L +# define __cpp_lib_constexpr_iterator 201811L # define __cpp_lib_constexpr_memory 201811L # define __cpp_lib_constexpr_numeric 201911L -// # define __cpp_lib_constexpr_string 201907L -// # define __cpp_lib_constexpr_string_view 201811L -// # define __cpp_lib_constexpr_tuple 201811L +# define __cpp_lib_constexpr_string 201811L +# define __cpp_lib_constexpr_string_view 201811L +# define __cpp_lib_constexpr_tuple 201811L # define __cpp_lib_constexpr_utility 201811L // # define __cpp_lib_constexpr_vector 201907L // # define __cpp_lib_coroutine 201902L diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.compile.fail.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.compile.fail.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.compile.fail.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.compile.fail.cpp @@ -19,7 +19,8 @@ int main(int, char**) { - std::back_insert_iterator > i = std::vector(); + std::vector v; + std::back_insert_iterator > i = v; return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/post.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/post.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/post.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/post.pass.cpp @@ -15,12 +15,13 @@ #include #include #include -#include "nasty_containers.h" #include "test_macros.h" +#include "nasty_containers.h" +#include "test_constexpr_container.h" template -void +TEST_CONSTEXPR_CXX20 bool test(C c) { std::back_insert_iterator i(c); @@ -28,12 +29,16 @@ r = 0; assert(c.size() == 1); assert(c.back() == 0); + return true; } int main(int, char**) { test(std::vector()); test(nasty_vector()); - - return 0; +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#endif + return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/pre.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/pre.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/pre.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/pre.pass.cpp @@ -12,26 +12,31 @@ // back_insert_iterator& operator++(); +#include #include #include -#include -#include "nasty_containers.h" #include "test_macros.h" +#include "nasty_containers.h" +#include "test_constexpr_container.h" template -void +TEST_CONSTEXPR_CXX20 bool test(C c) { std::back_insert_iterator i(c); std::back_insert_iterator& r = ++i; assert(&r == &i); + return true; } int main(int, char**) { test(std::vector()); test(nasty_vector()); - - return 0; +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#endif + return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/lv_value.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/lv_value.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/lv_value.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/lv_value.pass.cpp @@ -19,15 +19,17 @@ #include #include "test_macros.h" +#include "test_constexpr_container.h" template -void +TEST_CONSTEXPR_CXX14 bool test(C c) { const typename C::value_type v = typename C::value_type(); std::back_insert_iterator i(c); i = v; assert(c.back() == v); + return true; } class Copyable @@ -44,6 +46,9 @@ int main(int, char**) { test(std::vector()); - - return 0; +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#endif + return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/rv_value.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/rv_value.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/rv_value.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/rv_value.pass.cpp @@ -23,19 +23,24 @@ #include #include "test_macros.h" +#include "test_constexpr_container.h" template -void +TEST_CONSTEXPR_CXX14 bool test(C c) { std::back_insert_iterator i(c); i = typename C::value_type(); assert(c.back() == typename C::value_type()); + return true; } int main(int, char**) { test(std::vector >()); - - return 0; +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#endif + return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op_astrk/test.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op_astrk/test.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op_astrk/test.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op_astrk/test.pass.cpp @@ -12,26 +12,31 @@ // back_insert_iterator& operator*(); +#include #include #include -#include -#include "nasty_containers.h" #include "test_macros.h" +#include "nasty_containers.h" +#include "test_constexpr_container.h" template -void +TEST_CONSTEXPR_CXX20 bool test(C c) { std::back_insert_iterator i(c); std::back_insert_iterator& r = *i; assert(&r == &i); + return true; } int main(int, char**) { test(std::vector()); test(nasty_vector()); - - return 0; +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#endif + return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.compile.fail.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.compile.fail.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.compile.fail.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.compile.fail.cpp @@ -19,7 +19,8 @@ int main(int, char**) { - std::front_insert_iterator > i = std::list(); + std::list l; + std::front_insert_iterator > i = l; return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.pass.cpp @@ -14,21 +14,26 @@ #include #include -#include "nasty_containers.h" #include "test_macros.h" +#include "nasty_containers.h" +#include "test_constexpr_container.h" template -void +TEST_CONSTEXPR_CXX20 bool test(C c) { std::front_insert_iterator i(c); + return true; } int main(int, char**) { test(std::list()); test(nasty_list()); - - return 0; +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#endif + return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/post.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/post.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/post.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/post.pass.cpp @@ -12,15 +12,16 @@ // front_insert_iterator operator++(int); +#include #include #include -#include -#include "nasty_containers.h" #include "test_macros.h" +#include "nasty_containers.h" +#include "test_constexpr_container.h" template -void +TEST_CONSTEXPR_CXX20 bool test(C c) { std::front_insert_iterator i(c); @@ -28,12 +29,16 @@ r = 0; assert(c.size() == 1); assert(c.back() == 0); + return true; } int main(int, char**) { test(std::list()); test(nasty_list()); - - return 0; +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#endif + return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/pre.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/pre.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/pre.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/pre.pass.cpp @@ -12,26 +12,31 @@ // front_insert_iterator& operator++(); +#include #include #include -#include -#include "nasty_containers.h" #include "test_macros.h" +#include "nasty_containers.h" +#include "test_constexpr_container.h" template -void +TEST_CONSTEXPR_CXX20 bool test(C c) { std::front_insert_iterator i(c); std::front_insert_iterator& r = ++i; assert(&r == &i); + return true; } int main(int, char**) { test(std::list()); test(nasty_list()); - - return 0; +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#endif + return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/lv_value.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/lv_value.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/lv_value.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/lv_value.pass.cpp @@ -13,21 +13,23 @@ // front_insert_iterator& // operator=(const Cont::value_type& value); +#include #include #include -#include -#include "nasty_containers.h" #include "test_macros.h" +#include "nasty_containers.h" +#include "test_constexpr_container.h" template -void +TEST_CONSTEXPR_CXX20 bool test(C c) { const typename C::value_type v = typename C::value_type(); std::front_insert_iterator i(c); i = v; assert(c.front() == v); + return true; } class Copyable @@ -45,6 +47,9 @@ { test(std::list()); test(nasty_list()); - - return 0; +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#endif + return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/rv_value.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/rv_value.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/rv_value.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/rv_value.pass.cpp @@ -15,25 +15,30 @@ // front_insert_iterator& // operator=(Cont::value_type&& value); +#include #include #include #include -#include #include "test_macros.h" +#include "test_constexpr_container.h" template -void +TEST_CONSTEXPR_CXX20 bool test(C c) { std::front_insert_iterator i(c); i = typename C::value_type(); assert(c.front() == typename C::value_type()); + return true; } int main(int, char**) { test(std::list >()); - - return 0; +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#endif + return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op_astrk/test.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op_astrk/test.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op_astrk/test.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op_astrk/test.pass.cpp @@ -12,26 +12,31 @@ // front_insert_iterator& operator*(); +#include #include #include -#include -#include "nasty_containers.h" #include "test_macros.h" +#include "nasty_containers.h" +#include "test_constexpr_container.h" template -void +TEST_CONSTEXPR_CXX20 bool test(C c) { std::front_insert_iterator i(c); std::front_insert_iterator& r = *i; assert(&r == &i); + return true; } int main(int, char**) { test(std::list()); test(nasty_list()); - - return 0; +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#endif + return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.inserter/test.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.inserter/test.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.inserter/test.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.inserter/test.pass.cpp @@ -12,27 +12,32 @@ // front_insert_iterator // front_inserter(Cont& x); +#include #include #include -#include -#include "nasty_containers.h" #include "test_macros.h" +#include "nasty_containers.h" +#include "test_constexpr_container.h" template -void +TEST_CONSTEXPR_CXX20 bool test(C c) { std::front_insert_iterator i = std::front_inserter(c); i = 0; assert(c.size() == 1); assert(c.front() == 0); + return true; } int main(int, char**) { test(std::list()); test(nasty_list()); - - return 0; +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#endif + return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.cons/test.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.cons/test.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.cons/test.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.cons/test.pass.cpp @@ -14,21 +14,26 @@ #include #include -#include "nasty_containers.h" #include "test_macros.h" +#include "nasty_containers.h" +#include "test_constexpr_container.h" template -void +TEST_CONSTEXPR_CXX20 bool test(C c) { std::insert_iterator i(c, c.begin()); + return true; } int main(int, char**) { test(std::vector()); test(nasty_vector()); - - return 0; +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#endif + return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/post.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/post.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/post.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/post.pass.cpp @@ -12,15 +12,16 @@ // insert_iterator operator++(int); +#include #include #include -#include -#include "nasty_containers.h" #include "test_macros.h" +#include "nasty_containers.h" +#include "test_constexpr_container.h" template -void +TEST_CONSTEXPR_CXX20 bool test(C c) { std::insert_iterator i(c, c.end()); @@ -28,12 +29,16 @@ r = 0; assert(c.size() == 1); assert(c.back() == 0); + return true; } int main(int, char**) { test(std::vector()); test(nasty_vector()); - - return 0; +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#endif + return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/pre.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/pre.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/pre.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/pre.pass.cpp @@ -12,26 +12,31 @@ // insert_iterator& operator++(); +#include #include #include -#include -#include "nasty_containers.h" #include "test_macros.h" +#include "nasty_containers.h" +#include "test_constexpr_container.h" template -void +TEST_CONSTEXPR_CXX20 bool test(C c) { std::insert_iterator i(c, c.end()); std::insert_iterator& r = ++i; assert(&r == &i); + return true; } int main(int, char**) { test(std::vector()); test(nasty_vector()); - - return 0; +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#endif + return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op_astrk/test.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op_astrk/test.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op_astrk/test.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op_astrk/test.pass.cpp @@ -12,26 +12,31 @@ // insert_iterator& operator*(); +#include #include #include -#include -#include "nasty_containers.h" #include "test_macros.h" +#include "nasty_containers.h" +#include "test_constexpr_container.h" template -void +TEST_CONSTEXPR_CXX20 bool test(C c) { std::insert_iterator i(c, c.end()); std::insert_iterator& r = *i; assert(&r == &i); + return true; } int main(int, char**) { test(std::vector()); test(nasty_vector()); - - return 0; +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#endif + return 0; } diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/inserter/test.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/inserter/test.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/inserter/test.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/inserter/test.pass.cpp @@ -12,27 +12,32 @@ // insert_iterator // inserter(Cont& x, Cont::iterator i); +#include #include #include -#include -#include "nasty_containers.h" #include "test_macros.h" +#include "nasty_containers.h" +#include "test_constexpr_container.h" template -void +TEST_CONSTEXPR_CXX20 bool test(C c) { std::insert_iterator i = std::inserter(c, c.end()); i = 0; assert(c.size() == 1); assert(c.back() == 0); + return true; } int main(int, char**) { test(std::vector()); test(nasty_vector()); - - return 0; +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#endif + return 0; } diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.pass.cpp --- a/libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.pass.cpp @@ -146,17 +146,11 @@ # error "__cpp_lib_array_constexpr should have the value 201811L in c++20" # endif -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_constexpr_iterator -# error "__cpp_lib_constexpr_iterator should be defined in c++20" -# endif -# if __cpp_lib_constexpr_iterator != 201811L -# error "__cpp_lib_constexpr_iterator should have the value 201811L in c++20" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_constexpr_iterator -# error "__cpp_lib_constexpr_iterator should not be defined because it is unimplemented in libc++!" -# endif +# ifndef __cpp_lib_constexpr_iterator +# error "__cpp_lib_constexpr_iterator should be defined in c++20" +# endif +# if __cpp_lib_constexpr_iterator != 201811L +# error "__cpp_lib_constexpr_iterator should have the value 201811L in c++20" # endif # ifndef __cpp_lib_make_reverse_iterator @@ -209,17 +203,11 @@ # error "__cpp_lib_array_constexpr should have the value 201811L in c++2b" # endif -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_constexpr_iterator -# error "__cpp_lib_constexpr_iterator should be defined in c++2b" -# endif -# if __cpp_lib_constexpr_iterator != 201811L -# error "__cpp_lib_constexpr_iterator should have the value 201811L in c++2b" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_constexpr_iterator -# error "__cpp_lib_constexpr_iterator should not be defined because it is unimplemented in libc++!" -# endif +# ifndef __cpp_lib_constexpr_iterator +# error "__cpp_lib_constexpr_iterator should be defined in c++2b" +# endif +# if __cpp_lib_constexpr_iterator != 201811L +# error "__cpp_lib_constexpr_iterator should have the value 201811L in c++2b" # endif # ifndef __cpp_lib_make_reverse_iterator 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 201907L [C++20] + __cpp_lib_constexpr_string 201811L [C++20] __cpp_lib_erase_if 202002L [C++20] __cpp_lib_nonmember_container_access 201411L [C++17] __cpp_lib_starts_ends_with 201711L [C++20] @@ -182,17 +182,11 @@ # endif # endif -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_constexpr_string -# error "__cpp_lib_constexpr_string should be defined in c++20" -# endif -# if __cpp_lib_constexpr_string != 201907L -# error "__cpp_lib_constexpr_string should have the value 201907L in c++20" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_constexpr_string -# error "__cpp_lib_constexpr_string should not be defined because it is unimplemented in libc++!" -# endif +# 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" # endif # ifndef __cpp_lib_erase_if @@ -256,17 +250,11 @@ # endif # endif -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_constexpr_string -# error "__cpp_lib_constexpr_string should be defined in c++2b" -# endif -# if __cpp_lib_constexpr_string != 201907L -# error "__cpp_lib_constexpr_string should have the value 201907L in c++2b" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_constexpr_string -# error "__cpp_lib_constexpr_string should not be defined because it is unimplemented in libc++!" -# endif +# 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" # endif # ifndef __cpp_lib_erase_if diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/string_view.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/string_view.version.pass.cpp --- a/libcxx/test/std/language.support/support.limits/support.limits.general/string_view.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/string_view.version.pass.cpp @@ -111,17 +111,11 @@ # endif # endif -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_constexpr_string_view -# error "__cpp_lib_constexpr_string_view should be defined in c++20" -# endif -# if __cpp_lib_constexpr_string_view != 201811L -# error "__cpp_lib_constexpr_string_view should have the value 201811L in c++20" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_constexpr_string_view -# error "__cpp_lib_constexpr_string_view should not be defined because it is unimplemented in libc++!" -# endif +# ifndef __cpp_lib_constexpr_string_view +# error "__cpp_lib_constexpr_string_view should be defined in c++20" +# endif +# if __cpp_lib_constexpr_string_view != 201811L +# error "__cpp_lib_constexpr_string_view should have the value 201811L in c++20" # endif # ifndef __cpp_lib_starts_ends_with @@ -157,17 +151,11 @@ # endif # endif -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_constexpr_string_view -# error "__cpp_lib_constexpr_string_view should be defined in c++2b" -# endif -# if __cpp_lib_constexpr_string_view != 201811L -# error "__cpp_lib_constexpr_string_view should have the value 201811L in c++2b" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_constexpr_string_view -# error "__cpp_lib_constexpr_string_view should not be defined because it is unimplemented in libc++!" -# endif +# ifndef __cpp_lib_constexpr_string_view +# error "__cpp_lib_constexpr_string_view should be defined in c++2b" +# endif +# if __cpp_lib_constexpr_string_view != 201811L +# error "__cpp_lib_constexpr_string_view should have the value 201811L in c++2b" # endif # ifndef __cpp_lib_starts_ends_with diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/tuple.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/tuple.version.pass.cpp --- a/libcxx/test/std/language.support/support.limits/support.limits.general/tuple.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/tuple.version.pass.cpp @@ -119,17 +119,11 @@ # error "__cpp_lib_apply should have the value 201603L in c++20" # endif -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_constexpr_tuple -# error "__cpp_lib_constexpr_tuple should be defined in c++20" -# endif -# if __cpp_lib_constexpr_tuple != 201811L -# error "__cpp_lib_constexpr_tuple should have the value 201811L in c++20" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_constexpr_tuple -# error "__cpp_lib_constexpr_tuple should not be defined because it is unimplemented in libc++!" -# endif +# ifndef __cpp_lib_constexpr_tuple +# error "__cpp_lib_constexpr_tuple should be defined in c++20" +# endif +# if __cpp_lib_constexpr_tuple != 201811L +# error "__cpp_lib_constexpr_tuple should have the value 201811L in c++20" # endif # ifndef __cpp_lib_make_from_tuple @@ -162,17 +156,11 @@ # error "__cpp_lib_apply should have the value 201603L in c++2b" # endif -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_constexpr_tuple -# error "__cpp_lib_constexpr_tuple should be defined in c++2b" -# endif -# if __cpp_lib_constexpr_tuple != 201811L -# error "__cpp_lib_constexpr_tuple should have the value 201811L in c++2b" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_constexpr_tuple -# error "__cpp_lib_constexpr_tuple should not be defined because it is unimplemented in libc++!" -# endif +# ifndef __cpp_lib_constexpr_tuple +# error "__cpp_lib_constexpr_tuple should be defined in c++2b" +# endif +# if __cpp_lib_constexpr_tuple != 201811L +# error "__cpp_lib_constexpr_tuple should have the value 201811L in c++2b" # endif # ifndef __cpp_lib_make_from_tuple 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 @@ -53,7 +53,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 201907L [C++20] + __cpp_lib_constexpr_string 201811L [C++20] __cpp_lib_constexpr_string_view 201811L [C++20] __cpp_lib_constexpr_tuple 201811L [C++20] __cpp_lib_constexpr_utility 201811L [C++20] @@ -2436,17 +2436,11 @@ # error "__cpp_lib_constexpr_functional should have the value 201907L in c++20" # endif -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_constexpr_iterator -# error "__cpp_lib_constexpr_iterator should be defined in c++20" -# endif -# if __cpp_lib_constexpr_iterator != 201811L -# error "__cpp_lib_constexpr_iterator should have the value 201811L in c++20" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_constexpr_iterator -# error "__cpp_lib_constexpr_iterator should not be defined because it is unimplemented in libc++!" -# endif +# ifndef __cpp_lib_constexpr_iterator +# error "__cpp_lib_constexpr_iterator should be defined in c++20" +# endif +# if __cpp_lib_constexpr_iterator != 201811L +# error "__cpp_lib_constexpr_iterator should have the value 201811L in c++20" # endif # ifndef __cpp_lib_constexpr_memory @@ -2463,43 +2457,25 @@ # error "__cpp_lib_constexpr_numeric should have the value 201911L in c++20" # endif -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_constexpr_string -# error "__cpp_lib_constexpr_string should be defined in c++20" -# endif -# if __cpp_lib_constexpr_string != 201907L -# error "__cpp_lib_constexpr_string should have the value 201907L in c++20" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_constexpr_string -# error "__cpp_lib_constexpr_string should not be defined because it is unimplemented in libc++!" -# endif +# 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" # endif -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_constexpr_string_view -# error "__cpp_lib_constexpr_string_view should be defined in c++20" -# endif -# if __cpp_lib_constexpr_string_view != 201811L -# error "__cpp_lib_constexpr_string_view should have the value 201811L in c++20" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_constexpr_string_view -# error "__cpp_lib_constexpr_string_view should not be defined because it is unimplemented in libc++!" -# endif +# ifndef __cpp_lib_constexpr_string_view +# error "__cpp_lib_constexpr_string_view should be defined in c++20" +# endif +# if __cpp_lib_constexpr_string_view != 201811L +# error "__cpp_lib_constexpr_string_view should have the value 201811L in c++20" # endif -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_constexpr_tuple -# error "__cpp_lib_constexpr_tuple should be defined in c++20" -# endif -# if __cpp_lib_constexpr_tuple != 201811L -# error "__cpp_lib_constexpr_tuple should have the value 201811L in c++20" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_constexpr_tuple -# error "__cpp_lib_constexpr_tuple should not be defined because it is unimplemented in libc++!" -# endif +# ifndef __cpp_lib_constexpr_tuple +# error "__cpp_lib_constexpr_tuple should be defined in c++20" +# endif +# if __cpp_lib_constexpr_tuple != 201811L +# error "__cpp_lib_constexpr_tuple should have the value 201811L in c++20" # endif # ifndef __cpp_lib_constexpr_utility @@ -3647,17 +3623,11 @@ # error "__cpp_lib_constexpr_functional should have the value 201907L in c++2b" # endif -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_constexpr_iterator -# error "__cpp_lib_constexpr_iterator should be defined in c++2b" -# endif -# if __cpp_lib_constexpr_iterator != 201811L -# error "__cpp_lib_constexpr_iterator should have the value 201811L in c++2b" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_constexpr_iterator -# error "__cpp_lib_constexpr_iterator should not be defined because it is unimplemented in libc++!" -# endif +# ifndef __cpp_lib_constexpr_iterator +# error "__cpp_lib_constexpr_iterator should be defined in c++2b" +# endif +# if __cpp_lib_constexpr_iterator != 201811L +# error "__cpp_lib_constexpr_iterator should have the value 201811L in c++2b" # endif # ifndef __cpp_lib_constexpr_memory @@ -3674,43 +3644,25 @@ # error "__cpp_lib_constexpr_numeric should have the value 201911L in c++2b" # endif -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_constexpr_string -# error "__cpp_lib_constexpr_string should be defined in c++2b" -# endif -# if __cpp_lib_constexpr_string != 201907L -# error "__cpp_lib_constexpr_string should have the value 201907L in c++2b" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_constexpr_string -# error "__cpp_lib_constexpr_string should not be defined because it is unimplemented in libc++!" -# endif +# 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" # endif -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_constexpr_string_view -# error "__cpp_lib_constexpr_string_view should be defined in c++2b" -# endif -# if __cpp_lib_constexpr_string_view != 201811L -# error "__cpp_lib_constexpr_string_view should have the value 201811L in c++2b" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_constexpr_string_view -# error "__cpp_lib_constexpr_string_view should not be defined because it is unimplemented in libc++!" -# endif +# ifndef __cpp_lib_constexpr_string_view +# error "__cpp_lib_constexpr_string_view should be defined in c++2b" +# endif +# if __cpp_lib_constexpr_string_view != 201811L +# error "__cpp_lib_constexpr_string_view should have the value 201811L in c++2b" # endif -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_constexpr_tuple -# error "__cpp_lib_constexpr_tuple should be defined in c++2b" -# endif -# if __cpp_lib_constexpr_tuple != 201811L -# error "__cpp_lib_constexpr_tuple should have the value 201811L in c++2b" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_constexpr_tuple -# error "__cpp_lib_constexpr_tuple should not be defined because it is unimplemented in libc++!" -# endif +# ifndef __cpp_lib_constexpr_tuple +# error "__cpp_lib_constexpr_tuple should be defined in c++2b" +# endif +# if __cpp_lib_constexpr_tuple != 201811L +# error "__cpp_lib_constexpr_tuple should have the value 201811L in c++2b" # endif # ifndef __cpp_lib_constexpr_utility diff --git a/libcxx/test/std/strings/string.view/string.view.ops/copy.pass.cpp b/libcxx/test/std/strings/string.view/string.view.ops/copy.pass.cpp --- a/libcxx/test/std/strings/string.view/string.view.ops/copy.pass.cpp +++ b/libcxx/test/std/strings/string.view/string.view.ops/copy.pass.cpp @@ -6,6 +6,9 @@ // //===----------------------------------------------------------------------===// +// XFAIL: gcc-10 +// GCC's __builtin_strlen isn't constexpr yet + // // size_type copy(charT* s, size_type n, size_type pos = 0) const; @@ -74,7 +77,16 @@ test1(sv1, sv1.size() + 1, 0); test1(sv1, sv1.size() + 1, 1); test1(sv1, sv1.size() + 1, string_view_t::npos); +} +template +TEST_CONSTEXPR_CXX20 bool test_constexpr_copy(const CharT *abcde, const CharT *ghijk, const CharT *bcdjk) +{ + CharT buf[6] = {}; + std::basic_string_view lval(ghijk); lval.copy(buf, 6); + std::basic_string_view(abcde).copy(buf, 3, 1); + assert(std::basic_string_view(buf) == bcdjk); + return true; } int main(int, char**) { @@ -100,5 +112,22 @@ test ( U"" ); #endif + test_constexpr_copy("ABCDE", "GHIJK", "BCDJK"); + test_constexpr_copy(L"ABCDE", L"GHIJK", L"BCDJK"); +#if TEST_STD_VER >= 11 + test_constexpr_copy(u"ABCDE", u"GHIJK", u"BCDJK"); + test_constexpr_copy(U"ABCDE", U"GHIJK", U"BCDJK"); +#endif +#if TEST_STD_VER >= 17 + test_constexpr_copy(u8"ABCDE", u8"GHIJK", u8"BCDJK"); +#endif +#if TEST_STD_VER >= 20 + static_assert(test_constexpr_copy("ABCDE", "GHIJK", "BCDJK")); + static_assert(test_constexpr_copy(L"ABCDE", L"GHIJK", L"BCDJK")); + static_assert(test_constexpr_copy(u"ABCDE", u"GHIJK", u"BCDJK")); + static_assert(test_constexpr_copy(U"ABCDE", U"GHIJK", U"BCDJK")); + static_assert(test_constexpr_copy(u8"ABCDE", u8"GHIJK", u8"BCDJK")); +#endif + return 0; } diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/const_pair.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/const_pair.pass.cpp --- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/const_pair.pass.cpp +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/const_pair.pass.cpp @@ -30,7 +30,8 @@ #include "test_macros.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 +bool test() { { typedef std::pair T0; @@ -41,6 +42,16 @@ assert(std::get<0>(t1) == 2); assert(std::get<1>(t1) == short('a')); } + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER >= 20 + static_assert(test()); +#endif + { // test that the implicitly generated copy assignment operator // is properly deleted diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp --- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp @@ -21,35 +21,31 @@ #include "test_macros.h" -struct B -{ +struct B { int id_; - explicit B(int i = 0) : id_(i) {} + constexpr explicit B(int i = 0) : id_(i) {} }; -struct D - : B -{ - explicit D(int i = 0) : B(i) {} +struct D : B { + constexpr explicit D(int i = 0) : B(i) {} }; struct NonAssignable { - NonAssignable& operator=(NonAssignable const&) = delete; - NonAssignable& operator=(NonAssignable&&) = delete; + NonAssignable& operator=(NonAssignable const&) = delete; + NonAssignable& operator=(NonAssignable&&) = delete; }; -struct NothrowCopyAssignable -{ +struct NothrowCopyAssignable { NothrowCopyAssignable& operator=(NothrowCopyAssignable const&) noexcept { return *this; } }; -struct PotentiallyThrowingCopyAssignable -{ +struct PotentiallyThrowingCopyAssignable { PotentiallyThrowingCopyAssignable& operator=(PotentiallyThrowingCopyAssignable const&) { return *this; } }; -int main(int, char**) +TEST_CONSTEXPR_CXX20 +bool test() { { typedef std::tuple T0; @@ -102,6 +98,16 @@ assert(std::get<0>(t) == 43); assert(&std::get<0>(t) == &x); } + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER >= 20 + static_assert(test()); +#endif + { using T = std::tuple; using U = std::tuple; @@ -116,6 +122,7 @@ { typedef std::tuple T0; typedef std::tuple T1; + static_assert(std::is_assignable::value, ""); static_assert(!std::is_nothrow_assignable::value, ""); } diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp --- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp @@ -23,24 +23,19 @@ #include "test_macros.h" -struct B -{ +struct B { int id_; - - explicit B(int i= 0) : id_(i) {} - + explicit B(int i = 0) : id_(i) {} virtual ~B() {} }; -struct D - : B -{ +struct D : B { explicit D(int i) : B(i) {} }; struct E { - E() = default; - E& operator=(int) { + constexpr E() = default; + TEST_CONSTEXPR_CXX14 E& operator=(int) { return *this; } }; @@ -92,7 +87,8 @@ bool moved_from; }; -int main(int, char**) +TEST_CONSTEXPR_CXX20 +bool test() { { typedef std::tuple T0; @@ -111,6 +107,29 @@ assert(std::get<0>(t1) == 2); assert(std::get<1>(t1) == int('a')); } + { + // Test that tuple evaluates correctly applies an lvalue reference + // before evaluating is_assignable (i.e. 'is_assignable') + // instead of evaluating 'is_assignable' which is false. + int x = 42; + int y = 43; + std::tuple t(std::move(x), E{}); + std::tuple t2(std::move(y), 44); + t = std::move(t2); + assert(std::get<0>(t) == 43); + assert(&std::get<0>(t) == &x); + } + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER >= 20 + static_assert(test()); +#endif + { typedef std::tuple T0; typedef std::tuple T1; @@ -143,18 +162,7 @@ assert(std::get<1>(t1) == int('a')); assert(std::get<2>(t1)->id_ == 3); } - { - // Test that tuple evaluates correctly applies an lvalue reference - // before evaluating is_assignable (i.e. 'is_assignable') - // instead of evaluating 'is_assignable' which is false. - int x = 42; - int y = 43; - std::tuple t(std::move(x), E{}); - std::tuple t2(std::move(y), 44); - t = std::move(t2); - assert(std::get<0>(t) == 43); - assert(&std::get<0>(t) == &x); - } + { using T = std::tuple; using U = std::tuple; @@ -169,6 +177,7 @@ { typedef std::tuple T0; typedef std::tuple T1; + static_assert(std::is_assignable::value, ""); static_assert(!std::is_nothrow_assignable::value, ""); } { diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp --- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp @@ -45,7 +45,8 @@ CopyAssignableInt& operator=(int&) { return *this; } }; -int main(int, char**) +TEST_CONSTEXPR_CXX20 +bool test() { { typedef std::tuple<> T; @@ -68,15 +69,6 @@ assert(std::get<0>(t) == 2); assert(std::get<1>(t) == 'a'); } - { - typedef std::tuple T; - const T t0(2, 'a', "some text"); - T t; - t = t0; - assert(std::get<0>(t) == 2); - assert(std::get<1>(t) == 'a'); - assert(std::get<2>(t) == "some text"); - } { // test reference assignment. using T = std::tuple; @@ -92,6 +84,27 @@ assert(std::get<1>(t) == y2); assert(&std::get<1>(t) == &y); } + + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER >= 20 + static_assert(test()); +#endif + + { + // cannot be constexpr because of std::string + typedef std::tuple T; + const T t0(2, 'a', "some text"); + T t; + t = t0; + assert(std::get<0>(t) == 2); + assert(std::get<1>(t) == 'a'); + assert(std::get<2>(t) == "some text"); + } { // test that the implicitly generated copy assignment operator // is properly deleted @@ -99,8 +112,8 @@ static_assert(!std::is_copy_assignable::value, ""); } { - using T = std::tuple; - static_assert(!std::is_copy_assignable::value, ""); + using T = std::tuple; + static_assert(!std::is_copy_assignable::value, ""); } { using T = std::tuple; @@ -132,6 +145,7 @@ } { using T = std::tuple; + static_assert(std::is_copy_assignable::value, ""); static_assert(!std::is_nothrow_copy_assignable::value, ""); } diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/move.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/move.pass.cpp --- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/move.pass.cpp +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/move.pass.cpp @@ -53,7 +53,8 @@ int CountAssign::copied = 0; int CountAssign::moved = 0; -int main(int, char**) +TEST_CONSTEXPR_CXX20 +bool test() { { typedef std::tuple<> T; @@ -100,6 +101,16 @@ assert(std::get<1>(t) == y2); assert(&std::get<1>(t) == &y); } + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER >= 20 + static_assert(test()); +#endif + { // test that the implicitly generated move assignment operator // is properly deleted @@ -108,8 +119,8 @@ static_assert(!std::is_copy_assignable::value, ""); } { - using T = std::tuple; - static_assert(!std::is_move_assignable::value, ""); + using T = std::tuple; + static_assert(!std::is_move_assignable::value, ""); } { using T = std::tuple; diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.creation/make_tuple.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.creation/make_tuple.pass.cpp --- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.creation/make_tuple.pass.cpp +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.creation/make_tuple.pass.cpp @@ -21,26 +21,36 @@ #include "test_macros.h" +TEST_CONSTEXPR_CXX20 +bool test() +{ + int i = 0; + float j = 0; + std::tuple t = + std::make_tuple(1, std::ref(i), std::ref(j)); + assert(std::get<0>(t) == 1); + assert(std::get<1>(t) == 0); + assert(std::get<2>(t) == 0); + i = 2; + j = 3.5; + assert(std::get<0>(t) == 1); + assert(std::get<1>(t) == 2); + assert(std::get<2>(t) == 3.5); + std::get<1>(t) = 0; + std::get<2>(t) = 0; + assert(i == 0); + assert(j == 0); + + return true; +} + int main(int, char**) { - { - int i = 0; - float j = 0; - std::tuple t = std::make_tuple(1, std::ref(i), - std::ref(j)); - assert(std::get<0>(t) == 1); - assert(std::get<1>(t) == 0); - assert(std::get<2>(t) == 0); - i = 2; - j = 3.5; - assert(std::get<0>(t) == 1); - assert(std::get<1>(t) == 2); - assert(std::get<2>(t) == 3.5); - std::get<1>(t) = 0; - std::get<2>(t) = 0; - assert(i == 0); - assert(j == 0); - } + test(); +#if TEST_STD_VER >= 20 + static_assert(test()); +#endif + #if TEST_STD_VER > 11 { constexpr auto t1 = std::make_tuple(0, 1, 3.14); @@ -51,5 +61,5 @@ } #endif - return 0; + return 0; } diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp --- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp @@ -21,8 +21,9 @@ #include "test_macros.h" -#if TEST_STD_VER > 11 -constexpr bool test_tie_constexpr() { +TEST_CONSTEXPR_CXX14 +bool test_tie() +{ { int i = 42; double f = 1.1; @@ -32,15 +33,23 @@ assert(&std::get<0>(res) == &i); assert(&std::get<1>(res) == &std::ignore); assert(&std::get<2>(res) == &f); - // FIXME: If/when tuple gets constexpr assignment - //res = std::make_tuple(101, nullptr, -1.0); + +#if TEST_STD_VER >= 20 + res = std::make_tuple(101, nullptr, -1.0); + assert(i == 101); + assert(f == -1.0); +#endif } return true; } -#endif int main(int, char**) { + test_tie(); +#if TEST_STD_VER >= 14 + static_assert(test_tie(), ""); +#endif + { int i = 0; std::string s; @@ -48,18 +57,6 @@ assert(i == 42); assert(s == "C++"); } -#if TEST_STD_VER > 11 - { - static constexpr int i = 42; - static constexpr double f = 1.1; - constexpr std::tuple t = std::tie(i, f); - static_assert ( std::get<0>(t) == 42, "" ); - static_assert ( std::get<1>(t) == 1.1, "" ); - } - { - static_assert(test_tie_constexpr(), ""); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.swap/member_swap.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.swap/member_swap.pass.cpp --- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.swap/member_swap.pass.cpp +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.swap/member_swap.pass.cpp @@ -20,7 +20,8 @@ #include "test_macros.h" #include "MoveOnly.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 +bool test() { { typedef std::tuple<> T; @@ -58,6 +59,15 @@ assert(std::get<1>(t1) == 1); assert(std::get<2>(t1) == 2); } + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER >= 20 + static_assert(test()); +#endif - return 0; + return 0; } diff --git a/libcxx/test/std/utilities/utility/pairs/pair.piecewise/piecewise_construct.pass.cpp b/libcxx/test/std/utilities/utility/pairs/pair.piecewise/piecewise_construct.pass.cpp --- a/libcxx/test/std/utilities/utility/pairs/pair.piecewise/piecewise_construct.pass.cpp +++ b/libcxx/test/std/utilities/utility/pairs/pair.piecewise/piecewise_construct.pass.cpp @@ -26,9 +26,9 @@ int i_; char c_; public: - A(int i, char c) : i_(i), c_(c) {} - int get_i() const {return i_;} - char get_c() const {return c_;} + constexpr A(int i, char c) : i_(i), c_(c) {} + constexpr int get_i() const {return i_;} + constexpr char get_c() const {return c_;} }; class B @@ -37,13 +37,14 @@ unsigned u1_; unsigned u2_; public: - B(double d, unsigned u1, unsigned u2) : d_(d), u1_(u1), u2_(u2) {} - double get_d() const {return d_;} - unsigned get_u1() const {return u1_;} - unsigned get_u2() const {return u2_;} + constexpr explicit B(double d, unsigned u1, unsigned u2) : d_(d), u1_(u1), u2_(u2) {} + constexpr double get_d() const {return d_;} + constexpr unsigned get_u1() const {return u1_;} + constexpr unsigned get_u2() const {return u2_;} }; -int main(int, char**) +TEST_CONSTEXPR_CXX20 +bool test() { std::pair p(std::piecewise_construct, std::make_tuple(4, 'a'), @@ -54,5 +55,15 @@ assert(p.second.get_u1() == 6u); assert(p.second.get_u2() == 2u); - return 0; + return true; +} + +int main(int, char**) +{ + test(); +#if TEST_STD_VER >= 20 + static_assert(test()); +#endif + + return 0; } diff --git a/libcxx/test/support/test_constexpr_container.h b/libcxx/test/support/test_constexpr_container.h new file mode 100644 --- /dev/null +++ b/libcxx/test/support/test_constexpr_container.h @@ -0,0 +1,56 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#ifndef SUPPORT_TEST_CONSTEXPR_CONTAINER_H +#define SUPPORT_TEST_CONSTEXPR_CONTAINER_H + +// A dummy container with enough constexpr support to test the standard +// insert iterators, such as `back_insert_iterator`. + +#include +#include +#include + +#include "test_macros.h" + +#if TEST_STD_VER >= 14 + +template +class ConstexprFixedCapacityDeque { + T data_[N]; + int size_ = 0; +public: + using value_type = T; + using iterator = T *; + using const_iterator = T const *; + + constexpr ConstexprFixedCapacityDeque() = default; + constexpr iterator begin() { return data_; } + constexpr iterator end() { return data_ + size_; } + constexpr const_iterator begin() const { return data_; } + constexpr const_iterator end() const { return data_ + size_; } + constexpr size_t size() const { return size_; } + constexpr const T& front() const { assert(size_ >= 1); return data_[0]; } + constexpr const T& back() const { assert(size_ >= 1); return data_[size_-1]; } + + constexpr iterator insert(const_iterator pos, T t) { + int i = (pos - data_); + if (i != size_) { + std::move_backward(data_ + i, data_ + size_, data_ + size_ + 1); + } + data_[i] = std::move(t); + size_ += 1; + return data_ + i; + } + + constexpr void push_back(T t) { insert(end(), std::move(t)); } + constexpr void push_front(T t) { insert(begin(), std::move(t)); } +}; + +#endif // TEST_STD_VER >= 14 + +#endif // SUPPORT_TEST_CONSTEXPR_CONTAINER_H 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 @@ -198,7 +198,6 @@ "name": "__cpp_lib_constexpr_iterator", "values": { "c++20": 201811 }, "headers": ["iterator"], - "unimplemented": True, }, { "name": "__cpp_lib_constexpr_memory", "values": { "c++20": 201811 }, @@ -209,19 +208,16 @@ "headers": ["numeric"], }, { "name": "__cpp_lib_constexpr_string", - "values": { "c++20": 201907 }, + "values": { "c++20": 201811 }, # because P1032R1 is implemented; but should become 201907 after P0980R1 "headers": ["string"], - "unimplemented": True, }, { "name": "__cpp_lib_constexpr_string_view", "values": { "c++20": 201811 }, "headers": ["string_view"], - "unimplemented": True, }, { "name": "__cpp_lib_constexpr_tuple", "values": { "c++20": 201811 }, "headers": ["tuple"], - "unimplemented": True, }, { "name": "__cpp_lib_constexpr_utility", "values": { "c++20": 201811 },