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`` *unimplemented* ------------------------------------------------- ----------------- ``__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/chrono b/libcxx/include/chrono --- a/libcxx/include/chrono +++ b/libcxx/include/chrono @@ -2308,8 +2308,8 @@ year_month_day year_month_day::__from_days(days __d) noexcept { - static_assert(std::numeric_limits::digits >= 18, ""); - static_assert(std::numeric_limits::digits >= 20 , ""); + static_assert(numeric_limits::digits >= 18, ""); + static_assert(numeric_limits::digits >= 20 , ""); const int __z = __d.count() + 719468; const int __era = (__z >= 0 ? __z : __z - 146096) / 146097; const unsigned __doe = static_cast(__z - __era * 146097); // [0, 146096] @@ -2325,8 +2325,8 @@ // https://howardhinnant.github.io/date_algorithms.html#days_from_civil inline constexpr days year_month_day::__to_days() const noexcept { - static_assert(std::numeric_limits::digits >= 18, ""); - static_assert(std::numeric_limits::digits >= 20 , ""); + static_assert(numeric_limits::digits >= 18, ""); + static_assert(numeric_limits::digits >= 20 , ""); const int __yr = static_cast(__y) - (__m <= February); const unsigned __mth = static_cast(__m); @@ -2691,7 +2691,6 @@ { const sys_days __last = sys_days{__y/__m/last}; return (__last - (chrono::weekday{__last} - __wdl.weekday())).time_since_epoch(); - } inline constexpr 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 @@ -106,7 +106,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; @@ -356,7 +356,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,35 +38,35 @@ 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=(const tuple&); // constexpr in C++20 tuple& - operator=(tuple&&) noexcept(AND(is_nothrow_move_assignable::value ...)); + operator=(tuple&&) noexcept(AND(is_nothrow_move_assignable::value ...)); // 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 - void swap(tuple&) noexcept(AND(swap(declval(), declval())...)); + void swap(tuple&) noexcept(AND(swap(declval(), declval())...)); // constexpr in C++20 }; template @@ -170,7 +170,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) { @@ -191,29 +191,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, @@ -234,21 +235,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, @@ -258,7 +259,7 @@ __tuple_leaf(__tuple_leaf&& __t) = default; template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __tuple_leaf& operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value)) { @@ -266,7 +267,7 @@ return *this; } - _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); @@ -281,23 +282,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) {} @@ -314,17 +315,17 @@ : _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) {} @@ -332,7 +333,7 @@ __tuple_leaf(__tuple_leaf &&) = default; template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __tuple_leaf& operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value)) { @@ -340,7 +341,7 @@ return *this; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 int swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value) { @@ -353,7 +354,7 @@ }; template -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_INLINE_VISIBILITY constexpr void __swallow(_Tp&&...) _NOEXCEPT {} template @@ -373,7 +374,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...>, @@ -421,7 +422,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, @@ -430,7 +431,7 @@ {} template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename enable_if < __tuple_assignable<_Tuple, tuple<_Tp...> >::value, @@ -439,7 +440,7 @@ operator=(_Tuple&& __t) _NOEXCEPT_((__all::type>::type>::value...>::value)) { - __swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward::operator=(_VSTD::forward::type>::type>(_VSTD::get<_Indx>(__t)))...); return *this; } @@ -447,27 +448,27 @@ __tuple_impl(const __tuple_impl&) = default; __tuple_impl(__tuple_impl&&) = default; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __tuple_impl& operator=(const __tuple_impl& __t) _NOEXCEPT_((__all::value...>::value)) { - __swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast&>(__t).get())...); + _VSTD::__swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast&>(__t).get())...); return *this; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __tuple_impl& operator=(__tuple_impl&& __t) _NOEXCEPT_((__all::value...>::value)) { - __swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward<_Tp>(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t).get()))...); + _VSTD::__swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward<_Tp>(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t).get()))...); return *this; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 void swap(__tuple_impl& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) { - __swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...); + _VSTD::__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...); } }; @@ -652,14 +653,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) {} @@ -670,7 +671,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<>(), @@ -681,7 +682,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<>(), @@ -733,7 +734,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(), @@ -752,7 +753,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, @@ -839,7 +840,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(), @@ -858,7 +859,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, @@ -898,7 +899,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)) {} @@ -911,7 +912,7 @@ 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)) {} @@ -919,7 +920,7 @@ using _CanCopyAssign = __all::value...>; using _CanMoveAssign = __all::value...>; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple& operator=(typename conditional<_CanCopyAssign::value, tuple, __nat>::type const& __t) _NOEXCEPT_((__all::value...>::value)) { @@ -927,7 +928,7 @@ return *this; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple& operator=(typename conditional<_CanMoveAssign::value, tuple, __nat>::type&& __t) _NOEXCEPT_((__all::value...>::value)) { @@ -941,7 +942,7 @@ __tuple_assignable<_Tuple, tuple>::value >::type > - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 tuple& operator=(_Tuple&& __t) _NOEXCEPT_((is_nothrow_assignable<_BaseT&, _Tuple>::value)) { @@ -949,7 +950,7 @@ return *this; } - _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_);} }; @@ -958,21 +959,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 {} }; @@ -990,7 +991,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 @@ -300,12 +300,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] @@ -2429,17 +2429,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 # if !defined(_LIBCPP_VERSION) @@ -2462,43 +2456,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 @@ -3648,17 +3624,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 # if !defined(_LIBCPP_VERSION) @@ -3681,43 +3651,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 @@ -74,7 +74,17 @@ 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 *g, const CharT *bcdjk) +{ + CharT buf[6] = {}; + std::basic_string_view ghijk(g); + ghijk.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 +110,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/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 @@ -199,7 +199,6 @@ "name": "__cpp_lib_constexpr_iterator", "values": { "c++20": 201811 }, "headers": ["iterator"], - "unimplemented": True, }, { "name": "__cpp_lib_constexpr_memory", "values": { "c++20": 201811 }, @@ -211,19 +210,16 @@ "headers": ["numeric"], }, { "name": "__cpp_lib_constexpr_string", - "values": { "c++20": 201907 }, + "values": { "c++20": 201811 }, # but should be 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 },