diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst --- a/libcxx/docs/ReleaseNotes.rst +++ b/libcxx/docs/ReleaseNotes.rst @@ -46,6 +46,8 @@ - Implemented P0980R1 (Making ``std::string`` constexpr) +- Implemented P1004R2 (Making ``std::vector`` constexpr) + - `pop_heap` now uses an algorithm known as "bottom-up heapsort" or "heapsort with bounce" to reduce the number of comparisons, and rearranges elements using move-assignment instead of `swap`. diff --git a/libcxx/docs/Status/Cxx20Papers.csv b/libcxx/docs/Status/Cxx20Papers.csv --- a/libcxx/docs/Status/Cxx20Papers.csv +++ b/libcxx/docs/Status/Cxx20Papers.csv @@ -107,7 +107,7 @@ "`P0660R10 `__","LWG","Stop Token and Joining Thread, Rev 10","Cologne","","" "`P0784R7 `__","CWG","More constexpr containers","Cologne","|Complete|","12.0" "`P0980R1 `__","LWG","Making std::string constexpr","Cologne","|Complete|","15.0" -"`P1004R2 `__","LWG","Making std::vector constexpr","Cologne","","" +"`P1004R2 `__","LWG","Making std::vector constexpr","Cologne","|Complete|","15.0" "`P1035R7 `__","LWG","Input Range Adaptors","Cologne","","" "`P1065R2 `__","LWG","Constexpr INVOKE","Cologne","|Complete|","12.0" "`P1135R6 `__","LWG","The C++20 Synchronization Library","Cologne","|Complete|","11.0" diff --git a/libcxx/include/__split_buffer b/libcxx/include/__split_buffer --- a/libcxx/include/__split_buffer +++ b/libcxx/include/__split_buffer @@ -61,63 +61,64 @@ typedef typename add_lvalue_reference::type __alloc_ref; typedef typename add_lvalue_reference::type __alloc_const_ref; - _LIBCPP_INLINE_VISIBILITY __alloc_rr& __alloc() _NOEXCEPT {return __end_cap_.second();} - _LIBCPP_INLINE_VISIBILITY const __alloc_rr& __alloc() const _NOEXCEPT {return __end_cap_.second();} - _LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();} - _LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();} + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY __alloc_rr& __alloc() _NOEXCEPT {return __end_cap_.second();} + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const __alloc_rr& __alloc() const _NOEXCEPT {return __end_cap_.second();} + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();} + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY __split_buffer() _NOEXCEPT_(is_nothrow_default_constructible::value); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY explicit __split_buffer(__alloc_rr& __a); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY explicit __split_buffer(const __alloc_rr& __a); - __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a); - ~__split_buffer(); + _LIBCPP_CONSTEXPR_AFTER_CXX17 __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a); + _LIBCPP_CONSTEXPR_AFTER_CXX17 ~__split_buffer(); - __split_buffer(__split_buffer&& __c) + _LIBCPP_CONSTEXPR_AFTER_CXX17 __split_buffer(__split_buffer&& __c) _NOEXCEPT_(is_nothrow_move_constructible::value); - __split_buffer(__split_buffer&& __c, const __alloc_rr& __a); - __split_buffer& operator=(__split_buffer&& __c) + _LIBCPP_CONSTEXPR_AFTER_CXX17 __split_buffer(__split_buffer&& __c, const __alloc_rr& __a); + _LIBCPP_CONSTEXPR_AFTER_CXX17 __split_buffer& operator=(__split_buffer&& __c) _NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable::value) || !__alloc_traits::propagate_on_container_move_assignment::value); - _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;} - _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;} - _LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT {return __end_;} - _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT {return __end_;} + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;} + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;} + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT {return __end_;} + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT {return __end_;} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void clear() _NOEXCEPT {__destruct_at_end(__begin_);} - _LIBCPP_INLINE_VISIBILITY size_type size() const {return static_cast(__end_ - __begin_);} - _LIBCPP_INLINE_VISIBILITY bool empty() const {return __end_ == __begin_;} - _LIBCPP_INLINE_VISIBILITY size_type capacity() const {return static_cast(__end_cap() - __first_);} - _LIBCPP_INLINE_VISIBILITY size_type __front_spare() const {return static_cast(__begin_ - __first_);} - _LIBCPP_INLINE_VISIBILITY size_type __back_spare() const {return static_cast(__end_cap() - __end_);} - - _LIBCPP_INLINE_VISIBILITY reference front() {return *__begin_;} - _LIBCPP_INLINE_VISIBILITY const_reference front() const {return *__begin_;} - _LIBCPP_INLINE_VISIBILITY reference back() {return *(__end_ - 1);} - _LIBCPP_INLINE_VISIBILITY const_reference back() const {return *(__end_ - 1);} - - void reserve(size_type __n); - void shrink_to_fit() _NOEXCEPT; - void push_front(const_reference __x); - _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); - void push_front(value_type&& __x); - void push_back(value_type&& __x); + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY size_type size() const {return static_cast(__end_ - __begin_);} + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const {return __end_ == __begin_;} + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY size_type capacity() const {return static_cast(__end_cap() - __first_);} + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY size_type __front_spare() const {return static_cast(__begin_ - __first_);} + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY size_type __back_spare() const {return static_cast(__end_cap() - __end_);} + + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY reference front() {return *__begin_;} + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_reference front() const {return *__begin_;} + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY reference back() {return *(__end_ - 1);} + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_reference back() const {return *(__end_ - 1);} + + _LIBCPP_CONSTEXPR_AFTER_CXX17 void reserve(size_type __n); + _LIBCPP_CONSTEXPR_AFTER_CXX17 void shrink_to_fit() _NOEXCEPT; + _LIBCPP_CONSTEXPR_AFTER_CXX17 void push_front(const_reference __x); + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); + _LIBCPP_CONSTEXPR_AFTER_CXX17 void push_front(value_type&& __x); + _LIBCPP_CONSTEXPR_AFTER_CXX17 void push_back(value_type&& __x); template - void emplace_back(_Args&&... __args); + _LIBCPP_CONSTEXPR_AFTER_CXX17 void emplace_back(_Args&&... __args); - _LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);} - _LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);} + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);} + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);} - void __construct_at_end(size_type __n); - void __construct_at_end(size_type __n, const_reference __x); + _LIBCPP_CONSTEXPR_AFTER_CXX17 void __construct_at_end(size_type __n); + _LIBCPP_CONSTEXPR_AFTER_CXX17 void __construct_at_end(size_type __n, const_reference __x); template + _LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if < __is_cpp17_input_iterator<_InputIter>::value && @@ -126,6 +127,7 @@ >::type __construct_at_end(_InputIter __first, _InputIter __last); template + _LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if < __is_cpp17_forward_iterator<_ForwardIterator>::value, @@ -133,44 +135,44 @@ >::type __construct_at_end(_ForwardIterator __first, _ForwardIterator __last); - _LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin) + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin) {__destruct_at_begin(__new_begin, is_trivially_destructible());} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin, false_type); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin, true_type); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last) _NOEXCEPT {__destruct_at_end(__new_last, false_type());} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT; - void swap(__split_buffer& __x) + _LIBCPP_CONSTEXPR_AFTER_CXX17 void swap(__split_buffer& __x) _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value|| __is_nothrow_swappable<__alloc_rr>::value); - bool __invariants() const; + _LIBCPP_CONSTEXPR_AFTER_CXX17 bool __invariants() const; private: - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(__split_buffer& __c, true_type) _NOEXCEPT_(is_nothrow_move_assignable::value) { __alloc() = _VSTD::move(__c.__alloc()); } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT {} struct _ConstructTransaction { - explicit _ConstructTransaction(pointer* __p, size_type __n) _NOEXCEPT + _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit _ConstructTransaction(pointer* __p, size_type __n) _NOEXCEPT : __pos_(*__p), __end_(*__p + __n), __dest_(__p) { } - ~_ConstructTransaction() { + _LIBCPP_CONSTEXPR_AFTER_CXX17 ~_ConstructTransaction() { *__dest_ = __pos_; } pointer __pos_; @@ -181,6 +183,7 @@ }; template +_LIBCPP_CONSTEXPR_AFTER_CXX17 bool __split_buffer<_Tp, _Allocator>::__invariants() const { @@ -211,6 +214,7 @@ // Precondition: size() + __n <= capacity() // Postcondition: size() == size() + __n template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n) { @@ -227,6 +231,7 @@ // Postcondition: size() == old size() + __n // Postcondition: [i] == __x for all i in [size() - __n, __n) template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) { @@ -239,6 +244,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if < __is_cpp17_input_iterator<_InputIter>::value && @@ -267,6 +273,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if < __is_cpp17_forward_iterator<_ForwardIterator>::value, @@ -282,6 +289,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline void __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type) @@ -291,6 +299,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline void __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type) @@ -299,6 +308,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT @@ -308,6 +318,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT @@ -316,6 +327,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a) : __end_cap_(nullptr, __a) { @@ -331,6 +343,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline __split_buffer<_Tp, _Allocator>::__split_buffer() _NOEXCEPT_(is_nothrow_default_constructible::value) @@ -339,6 +352,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline __split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a) : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a) @@ -346,6 +360,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline __split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a) : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a) @@ -353,6 +368,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __split_buffer<_Tp, _Allocator>::~__split_buffer() { clear(); @@ -361,6 +377,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c) _NOEXCEPT_(is_nothrow_move_constructible::value) : __first_(_VSTD::move(__c.__first_)), @@ -375,6 +392,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a) : __end_cap_(nullptr, __a) { @@ -401,6 +419,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 __split_buffer<_Tp, _Allocator>& __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c) _NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value && @@ -421,6 +440,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void __split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x) _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value|| @@ -434,6 +454,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void __split_buffer<_Tp, _Allocator>::reserve(size_type __n) { @@ -450,6 +471,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void __split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT { @@ -477,6 +499,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void __split_buffer<_Tp, _Allocator>::push_front(const_reference __x) { @@ -506,6 +529,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x) { @@ -536,6 +560,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void __split_buffer<_Tp, _Allocator>::push_back(const_reference __x) @@ -566,6 +591,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x) { @@ -597,6 +623,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args) { @@ -627,6 +654,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y) diff --git a/libcxx/include/memory b/libcxx/include/memory --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -891,7 +891,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __construct_forward_with_exception_guarantees(_Alloc& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __begin2) { static_assert(__is_cpp17_move_insertable<_Alloc>::value, "The specified type does not meet the requirements of Cpp17MoveInsertable"); @@ -911,7 +911,7 @@ (__is_default_allocator<_Alloc>::value || !__has_construct<_Alloc, _Tp*, _Tp>::value) && is_trivially_move_constructible<_Tp>::value >::type> -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __construct_forward_with_exception_guarantees(_Alloc&, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2) { ptrdiff_t _Np = __end1 - __begin1; if (_Np > 0) { @@ -921,7 +921,7 @@ } template -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __construct_range_forward(_Alloc& __a, _Iter __begin1, _Iter __end1, _Ptr& __begin2) { typedef allocator_traits<_Alloc> _Traits; for (; __begin1 != __end1; ++__begin1, (void) ++__begin2) { @@ -938,7 +938,7 @@ is_same<_RawSource, _RawDest>::value && (__is_default_allocator<_Alloc>::value || !__has_construct<_Alloc, _Dest*, _Source&>::value) >::type> -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __construct_range_forward(_Alloc&, _Source* __begin1, _Source* __end1, _Dest*& __begin2) { ptrdiff_t _Np = __end1 - __begin1; if (_Np > 0) { @@ -948,7 +948,7 @@ } template -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __construct_backward_with_exception_guarantees(_Alloc& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __end2) { static_assert(__is_cpp17_move_insertable<_Alloc>::value, "The specified type does not meet the requirements of Cpp17MoveInsertable"); @@ -969,7 +969,7 @@ (__is_default_allocator<_Alloc>::value || !__has_construct<_Alloc, _Tp*, _Tp>::value) && is_trivially_move_constructible<_Tp>::value >::type> -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __construct_backward_with_exception_guarantees(_Alloc&, _Tp* __begin1, _Tp* __end1, _Tp*& __end2) { ptrdiff_t _Np = __end1 - __begin1; __end2 -= _Np; diff --git a/libcxx/include/vector b/libcxx/include/vector --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -347,12 +347,12 @@ static_assert((is_same::value), "Allocator::value_type must be same type as value_type"); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY vector() _NOEXCEPT_(is_nothrow_default_constructible::value) { _VSTD::__debug_db_insert_c(this); } - _LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a) + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a) #if _LIBCPP_STD_VER <= 14 _NOEXCEPT_(is_nothrow_copy_constructible::value) #else @@ -362,13 +362,14 @@ { _VSTD::__debug_db_insert_c(this); } - explicit vector(size_type __n); + _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit vector(size_type __n); #if _LIBCPP_STD_VER > 11 - explicit vector(size_type __n, const allocator_type& __a); + _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit vector(size_type __n, const allocator_type& __a); #endif - vector(size_type __n, const value_type& __x); + _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(size_type __n, const value_type& __x); template ::value> > + _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(size_type __n, const value_type& __x, const allocator_type& __a) : __end_cap_(nullptr, __a) { @@ -381,6 +382,7 @@ } template + _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(_InputIterator __first, typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value && !__is_cpp17_forward_iterator<_InputIterator>::value && @@ -389,6 +391,7 @@ typename iterator_traits<_InputIterator>::reference>::value, _InputIterator>::type __last); template + _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value && !__is_cpp17_forward_iterator<_InputIterator>::value && @@ -396,6 +399,7 @@ value_type, typename iterator_traits<_InputIterator>::reference>::value>::type* = 0); template + _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(_ForwardIterator __first, typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value && is_constructible< @@ -403,13 +407,14 @@ typename iterator_traits<_ForwardIterator>::reference>::value, _ForwardIterator>::type __last); template + _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value && is_constructible< value_type, typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY ~vector() { __annotate_delete(); @@ -424,19 +429,19 @@ } } - vector(const vector& __x); - vector(const vector& __x, const __type_identity_t& __a); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(const vector& __x); + _LIBCPP_CONSTEXPR_AFTER_CXX17 vector(const vector& __x, const __type_identity_t& __a); + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY vector& operator=(const vector& __x); #ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY vector(initializer_list __il); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY vector(initializer_list __il, const allocator_type& __a); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY vector(vector&& __x) #if _LIBCPP_STD_VER > 14 _NOEXCEPT; @@ -444,19 +449,20 @@ _NOEXCEPT_(is_nothrow_move_constructible::value); #endif - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY vector(vector&& __x, const __type_identity_t& __a); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY vector& operator=(vector&& __x) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY vector& operator=(initializer_list __il) {assign(__il.begin(), __il.end()); return *this;} #endif // !_LIBCPP_CXX03_LANG template + _LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if < __is_cpp17_input_iterator <_InputIterator>::value && @@ -468,6 +474,7 @@ >::type assign(_InputIterator __first, _InputIterator __last); template + _LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if < __is_cpp17_forward_iterator<_ForwardIterator>::value && @@ -478,113 +485,114 @@ >::type assign(_ForwardIterator __first, _ForwardIterator __last); - void assign(size_type __n, const_reference __u); + _LIBCPP_CONSTEXPR_AFTER_CXX17 void assign(size_type __n, const_reference __u); #ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void assign(initializer_list __il) {assign(__il.begin(), __il.end());} #endif - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT {return this->__alloc();} - _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT; + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT; + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT; + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT; + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const _NOEXCEPT {return begin();} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_iterator cend() const _NOEXCEPT {return end();} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const _NOEXCEPT {return rend();} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return static_cast(this->__end_ - this->__begin_);} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY size_type capacity() const _NOEXCEPT {return static_cast(__end_cap() - this->__begin_);} - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return this->__begin_ == this->__end_;} - size_type max_size() const _NOEXCEPT; - void reserve(size_type __n); - void shrink_to_fit() _NOEXCEPT; + _LIBCPP_CONSTEXPR_AFTER_CXX17 size_type max_size() const _NOEXCEPT; + _LIBCPP_CONSTEXPR_AFTER_CXX17 void reserve(size_type __n); + _LIBCPP_CONSTEXPR_AFTER_CXX17 void shrink_to_fit() _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const _NOEXCEPT; - reference at(size_type __n); - const_reference at(size_type __n) const; + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) _NOEXCEPT; + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const _NOEXCEPT; + _LIBCPP_CONSTEXPR_AFTER_CXX17 reference at(size_type __n); + _LIBCPP_CONSTEXPR_AFTER_CXX17 const_reference at(size_type __n) const; - _LIBCPP_INLINE_VISIBILITY reference front() _NOEXCEPT + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY reference front() _NOEXCEPT { _LIBCPP_ASSERT(!empty(), "front() called on an empty vector"); return *this->__begin_; } - _LIBCPP_INLINE_VISIBILITY const_reference front() const _NOEXCEPT + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_reference front() const _NOEXCEPT { _LIBCPP_ASSERT(!empty(), "front() called on an empty vector"); return *this->__begin_; } - _LIBCPP_INLINE_VISIBILITY reference back() _NOEXCEPT + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY reference back() _NOEXCEPT { _LIBCPP_ASSERT(!empty(), "back() called on an empty vector"); return *(this->__end_ - 1); } - _LIBCPP_INLINE_VISIBILITY const_reference back() const _NOEXCEPT + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_reference back() const _NOEXCEPT { _LIBCPP_ASSERT(!empty(), "back() called on an empty vector"); return *(this->__end_ - 1); } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY value_type* data() _NOEXCEPT {return _VSTD::__to_address(this->__begin_);} - _LIBCPP_INLINE_VISIBILITY + + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const value_type* data() const _NOEXCEPT {return _VSTD::__to_address(this->__begin_);} #ifdef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __emplace_back(const value_type& __x) { push_back(__x); } #else template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __emplace_back(_Arg&& __arg) { emplace_back(_VSTD::forward<_Arg>(__arg)); } #endif - _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); #ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY void push_back(value_type&& __x); + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void push_back(value_type&& __x); template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY #if _LIBCPP_STD_VER > 14 reference emplace_back(_Args&&... __args); #else @@ -592,19 +600,21 @@ #endif #endif // !_LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void pop_back(); - iterator insert(const_iterator __position, const_reference __x); + _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator insert(const_iterator __position, const_reference __x); #ifndef _LIBCPP_CXX03_LANG - iterator insert(const_iterator __position, value_type&& __x); + _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator insert(const_iterator __position, value_type&& __x); template + _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator emplace(const_iterator __position, _Args&&... __args); #endif // !_LIBCPP_CXX03_LANG - iterator insert(const_iterator __position, size_type __n, const_reference __x); + _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator insert(const_iterator __position, size_type __n, const_reference __x); template + _LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if < __is_cpp17_input_iterator <_InputIterator>::value && @@ -616,6 +626,7 @@ >::type insert(const_iterator __position, _InputIterator __first, _InputIterator __last); template + _LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if < __is_cpp17_forward_iterator<_ForwardIterator>::value && @@ -627,15 +638,15 @@ insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last); #ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __position, initializer_list __il) {return insert(__position, __il.begin(), __il.end());} #endif - _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position); - iterator erase(const_iterator __first, const_iterator __last); + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position); + _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator erase(const_iterator __first, const_iterator __last); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void clear() _NOEXCEPT { size_type __old_size = size(); @@ -644,10 +655,10 @@ __invalidate_all_iterators(); } - void resize(size_type __sz); - void resize(size_type __sz, const_reference __x); + _LIBCPP_CONSTEXPR_AFTER_CXX17 void resize(size_type __sz); + _LIBCPP_CONSTEXPR_AFTER_CXX17 void resize(size_type __sz, const_reference __x); - void swap(vector&) + _LIBCPP_CONSTEXPR_AFTER_CXX17 void swap(vector&) #if _LIBCPP_STD_VER >= 14 _NOEXCEPT; #else @@ -655,14 +666,14 @@ __is_nothrow_swappable::value); #endif - bool __invariants() const; + _LIBCPP_CONSTEXPR_AFTER_CXX17 bool __invariants() const; #if _LIBCPP_DEBUG_LEVEL == 2 - bool __dereferenceable(const const_iterator* __i) const; - bool __decrementable(const const_iterator* __i) const; - bool __addable(const const_iterator* __i, ptrdiff_t __n) const; - bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const; + _LIBCPP_CONSTEXPR_AFTER_CXX17 bool __dereferenceable(const const_iterator* __i) const; + _LIBCPP_CONSTEXPR_AFTER_CXX17 bool __decrementable(const const_iterator* __i) const; + _LIBCPP_CONSTEXPR_AFTER_CXX17 bool __addable(const const_iterator* __i, ptrdiff_t __n) const; + _LIBCPP_CONSTEXPR_AFTER_CXX17 bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const; #endif // _LIBCPP_DEBUG_LEVEL == 2 @@ -672,8 +683,8 @@ __compressed_pair __end_cap_ = __compressed_pair(nullptr, __default_init_tag()); - _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators(); - _LIBCPP_INLINE_VISIBILITY void __invalidate_iterators_past(pointer __new_last); + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators(); + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __invalidate_iterators_past(pointer __new_last); // Allocate space for __n objects @@ -683,7 +694,7 @@ // Precondition: __n > 0 // Postcondition: capacity() >= __n // Postcondition: size() == 0 - _LIBCPP_HIDE_FROM_ABI void __vallocate(size_type __n) { + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI void __vallocate(size_type __n) { if (__n > max_size()) __throw_length_error(); auto __allocation = std::__allocate_at_least(__alloc(), __n); @@ -693,32 +704,33 @@ __annotate_new(0); } - void __vdeallocate() _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const; - void __construct_at_end(size_type __n); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 void __vdeallocate() _NOEXCEPT; + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const; + _LIBCPP_CONSTEXPR_AFTER_CXX17 void __construct_at_end(size_type __n); + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, const_reference __x); template + _LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if < __is_cpp17_forward_iterator<_ForwardIterator>::value, void >::type __construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n); - void __append(size_type __n); - void __append(size_type __n, const_reference __x); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 void __append(size_type __n); + _LIBCPP_CONSTEXPR_AFTER_CXX17 void __append(size_type __n, const_reference __x); + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY iterator __make_iter(pointer __p) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(const_pointer __p) const _NOEXCEPT; - void __swap_out_circular_buffer(__split_buffer& __v); - pointer __swap_out_circular_buffer(__split_buffer& __v, pointer __p); - void __move_range(pointer __from_s, pointer __from_e, pointer __to); - void __move_assign(vector& __c, true_type) + _LIBCPP_CONSTEXPR_AFTER_CXX17 void __swap_out_circular_buffer(__split_buffer& __v); + _LIBCPP_CONSTEXPR_AFTER_CXX17 pointer __swap_out_circular_buffer(__split_buffer& __v, pointer __p); + _LIBCPP_CONSTEXPR_AFTER_CXX17 void __move_range(pointer __from_s, pointer __from_e, pointer __to); + _LIBCPP_CONSTEXPR_AFTER_CXX17 void __move_assign(vector& __c, true_type) _NOEXCEPT_(is_nothrow_move_assignable::value); - void __move_assign(vector& __c, false_type) + _LIBCPP_CONSTEXPR_AFTER_CXX17 void __move_assign(vector& __c, false_type) _NOEXCEPT_(__alloc_traits::is_always_equal::value); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last) _NOEXCEPT { __invalidate_iterators_past(__new_last); @@ -729,15 +741,15 @@ #ifndef _LIBCPP_CXX03_LANG template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY inline void __push_back_slow_path(_Up&& __x); template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY inline void __emplace_back_slow_path(_Args&&... __args); #else template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY inline void __push_back_slow_path(_Up& __x); #endif @@ -746,6 +758,7 @@ // may not meet the AddressSanitizer alignment constraints. // See the documentation for __sanitizer_annotate_contiguous_container for more details. #ifndef _LIBCPP_HAS_NO_ASAN + _LIBCPP_CONSTEXPR_AFTER_CXX17 void __annotate_contiguous_container(const void *__beg, const void *__end, const void *__old_mid, const void *__new_mid) const @@ -755,30 +768,30 @@ __sanitizer_annotate_contiguous_container(__beg, __end, __old_mid, __new_mid); } #else - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __annotate_contiguous_container(const void*, const void*, const void*, const void*) const _NOEXCEPT {} #endif - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __annotate_new(size_type __current_size) const _NOEXCEPT { __annotate_contiguous_container(data(), data() + capacity(), data() + capacity(), data() + __current_size); } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __annotate_delete() const _NOEXCEPT { __annotate_contiguous_container(data(), data() + capacity(), data() + size(), data() + capacity()); } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __annotate_increase(size_type __n) const _NOEXCEPT { __annotate_contiguous_container(data(), data() + capacity(), data() + size(), data() + size() + __n); } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __annotate_shrink(size_type __old_size) const _NOEXCEPT { __annotate_contiguous_container(data(), data() + capacity(), @@ -786,13 +799,14 @@ } struct _ConstructTransaction { + _LIBCPP_CONSTEXPR_AFTER_CXX17 explicit _ConstructTransaction(vector &__v, size_type __n) : __v_(__v), __pos_(__v.__end_), __new_end_(__v.__end_ + __n) { #ifndef _LIBCPP_HAS_NO_ASAN __v_.__annotate_increase(__n); #endif } - ~_ConstructTransaction() { + _LIBCPP_CONSTEXPR_AFTER_CXX17 ~_ConstructTransaction() { __v_.__end_ = __pos_; #ifndef _LIBCPP_HAS_NO_ASAN if (__pos_ != __new_end_) { @@ -811,7 +825,7 @@ }; template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __construct_one_at_end(_Args&& ...__args) { _ConstructTransaction __tx(*this, 1); __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__tx.__pos_), @@ -819,23 +833,23 @@ ++__tx.__pos_; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY allocator_type& __alloc() _NOEXCEPT {return this->__end_cap_.second();} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const allocator_type& __alloc() const _NOEXCEPT {return this->__end_cap_.second();} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return this->__end_cap_.first();} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return this->__end_cap_.first();} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __clear() _NOEXCEPT {__base_destruct_at_end(this->__begin_);} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __base_destruct_at_end(pointer __new_last) _NOEXCEPT { pointer __soon_to_be_end = this->__end_; while (__new_last != __soon_to_be_end) @@ -843,12 +857,12 @@ this->__end_ = __new_last; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __copy_assign_alloc(const vector& __c) {__copy_assign_alloc(__c, integral_constant());} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(vector& __c) _NOEXCEPT_( !__alloc_traits::propagate_on_container_move_assignment::value || @@ -866,7 +880,7 @@ _VSTD::__throw_out_of_range("vector"); } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __copy_assign_alloc(const vector& __c, true_type) { if (__alloc() != __c.__alloc()) @@ -878,18 +892,18 @@ __alloc() = __c.__alloc(); } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __copy_assign_alloc(const vector&, false_type) {} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(vector& __c, true_type) _NOEXCEPT_(is_nothrow_move_assignable::value) { __alloc() = _VSTD::move(__c.__alloc()); } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(vector&, false_type) _NOEXCEPT {} @@ -914,6 +928,7 @@ #endif template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer& __v) { @@ -929,6 +944,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename vector<_Tp, _Allocator>::pointer vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer& __v, pointer __p) { @@ -946,6 +962,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void vector<_Tp, _Allocator>::__vdeallocate() _NOEXCEPT { @@ -958,6 +975,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename vector<_Tp, _Allocator>::size_type vector<_Tp, _Allocator>::max_size() const _NOEXCEPT { @@ -967,6 +985,7 @@ // Precondition: __new_size > capacity() template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::size_type vector<_Tp, _Allocator>::__recommend(size_type __new_size) const @@ -986,6 +1005,7 @@ // Precondition: size() + __n <= capacity() // Postcondition: size() == size() + __n template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void vector<_Tp, _Allocator>::__construct_at_end(size_type __n) { @@ -1003,6 +1023,7 @@ // Postcondition: size() == old size() + __n // Postcondition: [i] == __x for all i in [size() - __n, __n) template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline void vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) @@ -1016,6 +1037,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if < __is_cpp17_forward_iterator<_ForwardIterator>::value, @@ -1032,6 +1054,7 @@ // Postcondition: size() == size() + __n // Exception safety: strong. template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void vector<_Tp, _Allocator>::__append(size_type __n) { @@ -1051,6 +1074,7 @@ // Postcondition: size() == size() + __n // Exception safety: strong. template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void vector<_Tp, _Allocator>::__append(size_type __n, const_reference __x) { @@ -1066,6 +1090,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 vector<_Tp, _Allocator>::vector(size_type __n) { _VSTD::__debug_db_insert_c(this); @@ -1078,6 +1103,7 @@ #if _LIBCPP_STD_VER > 11 template +_LIBCPP_CONSTEXPR_AFTER_CXX17 vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a) : __end_cap_(nullptr, __a) { @@ -1091,6 +1117,7 @@ #endif template +_LIBCPP_CONSTEXPR_AFTER_CXX17 vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x) { _VSTD::__debug_db_insert_c(this); @@ -1103,6 +1130,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 vector<_Tp, _Allocator>::vector(_InputIterator __first, typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value && !__is_cpp17_forward_iterator<_InputIterator>::value && @@ -1118,6 +1146,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, typename enable_if<__is_cpp17_input_iterator <_InputIterator>::value && !__is_cpp17_forward_iterator<_InputIterator>::value && @@ -1133,6 +1162,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 vector<_Tp, _Allocator>::vector(_ForwardIterator __first, typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value && is_constructible< @@ -1151,6 +1181,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, typename enable_if<__is_cpp17_forward_iterator<_ForwardIterator>::value && is_constructible< @@ -1168,6 +1199,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 vector<_Tp, _Allocator>::vector(const vector& __x) : __end_cap_(nullptr, __alloc_traits::select_on_container_copy_construction(__x.__alloc())) { @@ -1181,6 +1213,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 vector<_Tp, _Allocator>::vector(const vector& __x, const __type_identity_t& __a) : __end_cap_(nullptr, __a) { @@ -1196,6 +1229,7 @@ #ifndef _LIBCPP_CXX03_LANG template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>::vector(vector&& __x) #if _LIBCPP_STD_VER > 14 @@ -1216,6 +1250,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>::vector(vector&& __x, const __type_identity_t& __a) : __end_cap_(nullptr, __a) @@ -1239,6 +1274,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>::vector(initializer_list __il) { @@ -1251,6 +1287,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>::vector(initializer_list __il, const allocator_type& __a) : __end_cap_(nullptr, __a) @@ -1264,6 +1301,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>& vector<_Tp, _Allocator>::operator=(vector&& __x) @@ -1275,6 +1313,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void vector<_Tp, _Allocator>::__move_assign(vector& __c, false_type) _NOEXCEPT_(__alloc_traits::is_always_equal::value) @@ -1289,6 +1328,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type) _NOEXCEPT_(is_nothrow_move_assignable::value) @@ -1307,6 +1347,7 @@ #endif // !_LIBCPP_CXX03_LANG template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>& vector<_Tp, _Allocator>::operator=(const vector& __x) @@ -1321,6 +1362,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if < __is_cpp17_input_iterator <_InputIterator>::value && @@ -1339,6 +1381,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if < __is_cpp17_forward_iterator<_ForwardIterator>::value && @@ -1376,6 +1419,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u) { @@ -1398,6 +1442,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT @@ -1410,6 +1455,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::const_iterator vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT @@ -1422,6 +1468,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::begin() _NOEXCEPT @@ -1430,6 +1477,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::const_iterator vector<_Tp, _Allocator>::begin() const _NOEXCEPT @@ -1438,6 +1486,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::end() _NOEXCEPT @@ -1446,6 +1495,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::const_iterator vector<_Tp, _Allocator>::end() const _NOEXCEPT @@ -1454,6 +1504,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::reference vector<_Tp, _Allocator>::operator[](size_type __n) _NOEXCEPT @@ -1463,6 +1514,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::const_reference vector<_Tp, _Allocator>::operator[](size_type __n) const _NOEXCEPT @@ -1472,6 +1524,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename vector<_Tp, _Allocator>::reference vector<_Tp, _Allocator>::at(size_type __n) { @@ -1481,6 +1534,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename vector<_Tp, _Allocator>::const_reference vector<_Tp, _Allocator>::at(size_type __n) const { @@ -1490,6 +1544,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void vector<_Tp, _Allocator>::reserve(size_type __n) { @@ -1504,6 +1559,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void vector<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT { @@ -1527,6 +1583,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void #ifndef _LIBCPP_CXX03_LANG vector<_Tp, _Allocator>::__push_back_slow_path(_Up&& __x) @@ -1543,6 +1600,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void vector<_Tp, _Allocator>::push_back(const_reference __x) @@ -1558,6 +1616,7 @@ #ifndef _LIBCPP_CXX03_LANG template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void vector<_Tp, _Allocator>::push_back(value_type&& __x) @@ -1572,6 +1631,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args) { @@ -1585,6 +1645,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline #if _LIBCPP_STD_VER > 14 typename vector<_Tp, _Allocator>::reference @@ -1607,6 +1668,7 @@ #endif // !_LIBCPP_CXX03_LANG template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline void vector<_Tp, _Allocator>::pop_back() @@ -1616,6 +1678,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::erase(const_iterator __position) @@ -1633,6 +1696,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last) { @@ -1652,6 +1716,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointer __to) { @@ -1671,6 +1736,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) { @@ -1705,6 +1771,7 @@ #ifndef _LIBCPP_CXX03_LANG template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x) { @@ -1735,6 +1802,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) { @@ -1767,6 +1835,7 @@ #endif // !_LIBCPP_CXX03_LANG template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x) { @@ -1807,6 +1876,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if < __is_cpp17_input_iterator <_InputIterator>::value && @@ -1858,6 +1928,7 @@ template template +_LIBCPP_CONSTEXPR_AFTER_CXX17 typename enable_if < __is_cpp17_forward_iterator<_ForwardIterator>::value && @@ -1906,6 +1977,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void vector<_Tp, _Allocator>::resize(size_type __sz) { @@ -1917,6 +1989,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void vector<_Tp, _Allocator>::resize(size_type __sz, const_reference __x) { @@ -1928,6 +2001,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 void vector<_Tp, _Allocator>::swap(vector& __x) #if _LIBCPP_STD_VER >= 14 @@ -1952,6 +2026,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 bool vector<_Tp, _Allocator>::__invariants() const { @@ -1975,6 +2050,7 @@ #if _LIBCPP_DEBUG_LEVEL == 2 template +_LIBCPP_CONSTEXPR_AFTER_CXX17 bool vector<_Tp, _Allocator>::__dereferenceable(const const_iterator* __i) const { @@ -1982,6 +2058,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 bool vector<_Tp, _Allocator>::__decrementable(const const_iterator* __i) const { @@ -1989,6 +2066,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 bool vector<_Tp, _Allocator>::__addable(const const_iterator* __i, ptrdiff_t __n) const { @@ -1997,6 +2075,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 bool vector<_Tp, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __n) const { @@ -2007,6 +2086,7 @@ #endif // _LIBCPP_DEBUG_LEVEL == 2 template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void vector<_Tp, _Allocator>::__invalidate_all_iterators() @@ -2018,6 +2098,7 @@ template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void vector<_Tp, _Allocator>::__invalidate_iterators_past(pointer __new_last) { @@ -2340,7 +2421,7 @@ // Precondition: __n > 0 // Postcondition: capacity() >= __n // Postcondition: size() == 0 - _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators(); + _LIBCPP_CONSTEXPR_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators(); _LIBCPP_HIDE_FROM_ABI void __vallocate(size_type __n) { if (__n > max_size()) __throw_length_error(); @@ -2431,7 +2512,7 @@ }; template -inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void vector::__invalidate_all_iterators() { @@ -3234,6 +3315,7 @@ }; template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY bool operator==(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) @@ -3243,6 +3325,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) @@ -3251,6 +3334,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY bool operator< (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) @@ -3259,6 +3343,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY bool operator> (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) @@ -3267,6 +3352,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY bool operator>=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) @@ -3275,6 +3361,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY bool operator<=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) @@ -3283,6 +3370,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void swap(vector<_Tp, _Allocator>& __x, vector<_Tp, _Allocator>& __y) @@ -3293,6 +3381,7 @@ #if _LIBCPP_STD_VER > 17 template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::size_type erase(vector<_Tp, _Allocator>& __c, const _Up& __v) { auto __old_size = __c.size(); @@ -3301,6 +3390,7 @@ } template +_LIBCPP_CONSTEXPR_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::size_type erase_if(vector<_Tp, _Allocator>& __c, _Predicate __pred) { auto __old_size = __c.size(); diff --git a/libcxx/test/std/containers/sequences/vector.bool/assign_copy.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/assign_copy.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/assign_copy.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/assign_copy.pass.cpp @@ -16,7 +16,7 @@ #include "test_allocator.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector > l(3, true, test_allocator(5)); @@ -42,5 +42,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp @@ -18,7 +18,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector d; @@ -39,5 +39,14 @@ assert(d[3] == true); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/assign_move.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/assign_move.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/assign_move.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/assign_move.pass.cpp @@ -18,7 +18,7 @@ #include "test_allocator.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector > l(test_allocator(5)); @@ -77,5 +77,14 @@ assert(l2.get_allocator() == lo.get_allocator()); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/capacity.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/capacity.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/capacity.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/capacity.pass.cpp @@ -17,7 +17,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector v; @@ -42,5 +42,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/construct_default.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/construct_default.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/construct_default.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/construct_default.pass.cpp @@ -24,8 +24,7 @@ #include "min_allocator.h" template -void -test0() +TEST_CONSTEXPR_CXX20 void test0() { #if TEST_STD_VER > 14 LIBCPP_STATIC_ASSERT((noexcept(C{})), "" ); @@ -45,8 +44,7 @@ } template -void -test1(const typename C::allocator_type& a) +TEST_CONSTEXPR_CXX20 void test1(const typename C::allocator_type& a) { #if TEST_STD_VER > 14 LIBCPP_STATIC_ASSERT((noexcept(C{typename C::allocator_type{}})), "" ); @@ -59,7 +57,7 @@ assert(c.get_allocator() == a); } -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { test0 >(); @@ -76,5 +74,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp @@ -20,8 +20,7 @@ #include "min_allocator.h" template -void -test(Iterator first, Iterator last) +TEST_CONSTEXPR_CXX20 void test(Iterator first, Iterator last) { C c(first, last); LIBCPP_ASSERT(c.__invariants()); @@ -30,7 +29,7 @@ assert(*i == *first); } -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0}; bool* an = a + sizeof(a)/sizeof(a[0]); @@ -47,5 +46,14 @@ test> >(a, an); #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp @@ -21,8 +21,7 @@ #include "min_allocator.h" template -void -test(Iterator first, Iterator last, const typename C::allocator_type& a) +TEST_CONSTEXPR_CXX20 void test(Iterator first, Iterator last, const typename C::allocator_type& a) { C c(first, last, a); LIBCPP_ASSERT(c.__invariants()); @@ -31,7 +30,7 @@ assert(*i == *first); } -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0}; bool* an = a + sizeof(a)/sizeof(a[0]); @@ -54,5 +53,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/construct_size.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/construct_size.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/construct_size.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/construct_size.pass.cpp @@ -19,9 +19,8 @@ #include "test_allocator.h" template -void -test2(typename C::size_type n, - typename C::allocator_type const& a = typename C::allocator_type ()) +TEST_CONSTEXPR_CXX20 void test2(typename C::size_type n, + typename C::allocator_type const& a = typename C::allocator_type ()) { #if TEST_STD_VER >= 14 C c(n, a); @@ -37,8 +36,7 @@ } template -void -test1(typename C::size_type n) +TEST_CONSTEXPR_CXX20 void test1(typename C::size_type n) { C c(n); LIBCPP_ASSERT(c.__invariants()); @@ -49,14 +47,13 @@ } template -void -test(typename C::size_type n) +TEST_CONSTEXPR_CXX20 void test(typename C::size_type n) { test1 ( n ); test2 ( n ); } -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { test >(50); #if TEST_STD_VER >= 11 @@ -64,5 +61,14 @@ test2> >( 100, test_allocator(23)); #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/construct_size_value.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/construct_size_value.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/construct_size_value.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/construct_size_value.pass.cpp @@ -18,8 +18,7 @@ #include "min_allocator.h" template -void -test(typename C::size_type n, const typename C::value_type& x) +TEST_CONSTEXPR_CXX20 void test(typename C::size_type n, const typename C::value_type& x) { C c(n, x); LIBCPP_ASSERT(c.__invariants()); @@ -28,12 +27,21 @@ assert(*i == x); } -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { test >(50, true); #if TEST_STD_VER >= 11 test> >(50, true); #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp @@ -18,9 +18,9 @@ #include "min_allocator.h" template -void -test(typename C::size_type n, const typename C::value_type& x, - const typename C::allocator_type& a) +TEST_CONSTEXPR_CXX20 void test(typename C::size_type n, + const typename C::value_type& x, + const typename C::allocator_type& a) { C c(n, x, a); LIBCPP_ASSERT(c.__invariants()); @@ -30,12 +30,21 @@ assert(*i == x); } -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { test >(50, true, std::allocator()); #if TEST_STD_VER >= 11 test> >(50, true, min_allocator()); #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/copy.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/copy.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/copy.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/copy.pass.cpp @@ -19,8 +19,7 @@ #include "min_allocator.h" template -void -test(const C& x) +TEST_CONSTEXPR_CXX20 void test(const C& x) { typename C::size_type s = x.size(); C c(x); @@ -29,7 +28,7 @@ assert(c == x); } -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0}; @@ -62,5 +61,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp @@ -18,8 +18,7 @@ #include "min_allocator.h" template -void -test(const C& x, const typename C::allocator_type& a) +TEST_CONSTEXPR_CXX20 void test(const C& x, const typename C::allocator_type& a) { typename C::size_type s = x.size(); C c(x, a); @@ -28,7 +27,7 @@ assert(c == x); } -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0}; @@ -63,3 +62,12 @@ return 0; } + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; +} diff --git a/libcxx/test/std/containers/sequences/vector.bool/emplace.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/emplace.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/emplace.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/emplace.pass.cpp @@ -17,7 +17,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { typedef std::vector C; @@ -65,5 +65,14 @@ assert(c.back() == true); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp @@ -18,7 +18,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { typedef std::vector C; @@ -88,5 +88,14 @@ assert(c.back() == true); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/empty.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/empty.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/empty.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/empty.pass.cpp @@ -18,7 +18,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { typedef std::vector C; @@ -43,5 +43,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/erase_iter.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/erase_iter.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/erase_iter.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/erase_iter.pass.cpp @@ -17,7 +17,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { bool a1[] = {1, 0, 1}; { @@ -63,5 +63,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/erase_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/erase_iter_iter.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/erase_iter_iter.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/erase_iter_iter.pass.cpp @@ -17,7 +17,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { bool a1[] = {1, 0, 1}; { @@ -83,5 +83,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/find.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/find.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/find.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/find.pass.cpp @@ -20,7 +20,7 @@ #include "test_macros.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { for (unsigned i = 1; i < 256; ++i) @@ -41,5 +41,14 @@ } } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp @@ -18,7 +18,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector d = {true, false, false, true}; @@ -37,5 +37,14 @@ assert(d[3] == true); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp @@ -19,7 +19,7 @@ #include "test_allocator.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector> d({true, false, false, true}, test_allocator(3)); @@ -40,5 +40,14 @@ assert(d[3] == true); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp @@ -18,7 +18,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector d(10, true); @@ -61,5 +61,14 @@ assert(d[13] == true); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp @@ -20,7 +20,7 @@ #include "test_iterators.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector v(100); @@ -142,5 +142,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp @@ -18,7 +18,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector v(100); @@ -87,5 +87,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp @@ -18,7 +18,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector v(100); @@ -84,5 +84,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/iterators.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/iterators.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/iterators.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/iterators.pass.cpp @@ -22,7 +22,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { using IterRefT = std::iterator_traits::iterator>::reference; ASSERT_SAME_TYPE(IterRefT, std::vector::reference); @@ -130,5 +130,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/move.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/move.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/move.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/move.pass.cpp @@ -18,7 +18,7 @@ #include "test_allocator.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { test_allocator_statistics alloc_stats; { @@ -91,5 +91,14 @@ } } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp @@ -18,7 +18,7 @@ #include "test_allocator.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector > l(test_allocator(5)); @@ -73,5 +73,14 @@ assert(l2.get_allocator() == min_allocator()); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp @@ -18,7 +18,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector d; @@ -39,5 +39,14 @@ assert(d[3] == true); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/push_back.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/push_back.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/push_back.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/push_back.pass.cpp @@ -18,7 +18,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { bool a[] = {0, 1, 1, 0, 1, 0, 0}; @@ -47,5 +47,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/reference.swap.pass.cpp @@ -16,7 +16,7 @@ #include "test_macros.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { bool a[] = {false, true, false, true}; @@ -36,5 +36,14 @@ assert( r1); assert(!r2); - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/reserve.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/reserve.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/reserve.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/reserve.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" #include "test_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector v; @@ -76,5 +76,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/resize_size.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/resize_size.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/resize_size.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/resize_size.pass.cpp @@ -17,7 +17,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector v(100); @@ -54,5 +54,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/resize_size_value.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/resize_size_value.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/resize_size_value.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/resize_size_value.pass.cpp @@ -17,7 +17,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector v(100); @@ -50,5 +50,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp @@ -17,7 +17,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector v(100); @@ -36,5 +36,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/size.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/size.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/size.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/size.pass.cpp @@ -18,7 +18,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { typedef std::vector C; @@ -59,5 +59,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/swap.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/swap.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/swap.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/swap.pass.cpp @@ -17,7 +17,7 @@ #include "test_allocator.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector v1(100); @@ -96,5 +96,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp @@ -24,7 +24,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { typedef std::vector T; @@ -52,5 +52,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/access.pass.cpp b/libcxx/test/std/containers/sequences/vector/access.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/access.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/access.pass.cpp @@ -29,9 +29,7 @@ #include "test_macros.h" template -C -make(int size, int start) -{ +TEST_CONSTEXPR_CXX20 C make(int size, int start) { C c; for (int i = 0; i < size; ++i) c.push_back(start + i); @@ -39,7 +37,7 @@ } template -void test_get_basic(Vector& c, int start_value) { +TEST_CONSTEXPR_CXX20 void test_get_basic(Vector& c, int start_value) { const int n = static_cast(c.size()); for (int i = 0; i < n; ++i) assert(c[i] == start_value + i); @@ -58,7 +56,7 @@ } template -void test_get() { +TEST_CONSTEXPR_CXX20 void test_get() { int start_value = 35; Vector c = make(10, start_value); const Vector& cc = c; @@ -67,7 +65,7 @@ } template -void test_set() { +TEST_CONSTEXPR_CXX20 void test_set() { int start_value = 35; const int n = 10; Vector c = make(n, start_value); @@ -93,7 +91,7 @@ } template -void test() { +TEST_CONSTEXPR_CXX20 void test() { test_get(); test_set(); @@ -112,12 +110,18 @@ ASSERT_SAME_TYPE(typename Vector::const_reference, decltype(cc.back())); } -int main(int, char**) -{ +TEST_CONSTEXPR_CXX20 bool tests() { test >(); #if TEST_STD_VER >= 11 test > >(); #endif + return true; +} - return 0; +int main(int, char**) { + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/contiguous.pass.cpp b/libcxx/test/std/containers/sequences/vector/contiguous.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/contiguous.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/contiguous.pass.cpp @@ -18,13 +18,13 @@ #include "min_allocator.h" template -void test_contiguous ( const C &c ) +TEST_CONSTEXPR_CXX20 void test_contiguous(const C &c) { for ( size_t i = 0; i < c.size(); ++i ) assert ( *(c.begin() + static_cast(i)) == *(std::addressof(*c.begin()) + i)); } -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { typedef int T; @@ -50,5 +50,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/iterators.pass.cpp b/libcxx/test/std/containers/sequences/vector/iterators.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/iterators.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/iterators.pass.cpp @@ -28,7 +28,7 @@ int second; }; -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { typedef int T; @@ -167,5 +167,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.capacity/capacity.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.capacity/capacity.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.capacity/capacity.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.capacity/capacity.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector v; @@ -46,5 +46,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.capacity/empty.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.capacity/empty.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.capacity/empty.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.capacity/empty.pass.cpp @@ -18,8 +18,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) -{ +TEST_CONSTEXPR_CXX20 bool tests() { { typedef std::vector C; C c; @@ -43,5 +42,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.capacity/max_size.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.capacity/max_size.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.capacity/max_size.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.capacity/max_size.pass.cpp @@ -19,7 +19,7 @@ #include "test_macros.h" -int main(int, char**) { +TEST_CONSTEXPR_CXX20 bool test() { { typedef limited_allocator A; typedef std::vector C; @@ -45,5 +45,15 @@ assert(c.max_size() <= alloc_max_size(c.get_allocator())); } + return true; +} + +int main(int, char**) { + test(); + +#if TEST_STD_VER > 17 + static_assert(test()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp @@ -18,8 +18,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) -{ +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector v; v.reserve(10); @@ -118,5 +117,16 @@ } #endif + return true; +} + +int main(int, char**) +{ + tests(); + +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp @@ -19,8 +19,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) -{ +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector v(100); v.resize(50); @@ -81,5 +80,16 @@ } #endif + return true; +} + +int main(int, char**) +{ + tests(); + +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp @@ -17,8 +17,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) -{ +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector v(100); v.resize(50, 1); @@ -75,5 +74,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp @@ -17,8 +17,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) -{ +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector v(100); v.push_back(1); @@ -60,5 +59,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.capacity/size.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.capacity/size.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.capacity/size.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.capacity/size.pass.cpp @@ -18,7 +18,7 @@ #include "test_macros.h" #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { typedef std::vector C; @@ -59,5 +59,14 @@ } #endif + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.capacity/swap.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.capacity/swap.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.capacity/swap.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.capacity/swap.pass.cpp @@ -17,8 +17,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) -{ +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector v1(100); std::vector v2(200); @@ -48,5 +47,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_copy.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_copy.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_copy.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_copy.pass.cpp @@ -17,8 +17,7 @@ #include "min_allocator.h" #include "allocators.h" -int main(int, char**) -{ +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector > l(3, 2, test_allocator(5)); std::vector > l2(l, test_allocator(3)); @@ -81,5 +80,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp @@ -20,7 +20,7 @@ #include "asan_testing.h" template -void test ( Vec &v ) +TEST_CONSTEXPR_CXX20 void test(Vec &v) { v.assign({3, 4, 5, 6}); assert(v.size() == 4); @@ -31,8 +31,7 @@ assert(v[3] == 6); } -int main(int, char**) -{ +TEST_CONSTEXPR_CXX20 bool tests() { { typedef std::vector V; V d1; @@ -50,5 +49,14 @@ test(d2); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_iter_iter.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_iter_iter.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_iter_iter.pass.cpp @@ -23,7 +23,7 @@ #endif -void test() { +TEST_CONSTEXPR_CXX20 bool test() { #if TEST_STD_VER >= 11 int arr1[] = {42}; int arr2[] = {1, 101, 42}; @@ -77,9 +77,14 @@ dst.assign(It(src.data()), It(src.data() + src.size())); assert(dst == src); } + + return true; } int main(int, char**) { test(); +#if TEST_STD_VER > 17 + static_assert(test()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp @@ -20,8 +20,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) -{ +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector > l(test_allocator(5)); std::vector > lo(test_allocator(5)); @@ -97,5 +96,14 @@ assert(is_contiguous_container_asan_correct(l2)); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/assign_size_value.pass.cpp @@ -18,10 +18,10 @@ #include "min_allocator.h" #include "asan_testing.h" -bool is6(int x) { return x == 6; } +TEST_CONSTEXPR bool is6(int x) { return x == 6; } template -void test ( Vec &v ) +TEST_CONSTEXPR_CXX20 void test(Vec &v) { v.assign(5, 6); assert(v.size() == 5); @@ -29,8 +29,7 @@ assert(std::all_of(v.begin(), v.end(), is6)); } -int main(int, char**) -{ +TEST_CONSTEXPR_CXX20 bool tests() { { typedef std::vector V; V d1; @@ -56,5 +55,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp @@ -22,8 +22,7 @@ #include "asan_testing.h" template -void -test0() +TEST_CONSTEXPR_CXX20 void test0() { #if TEST_STD_VER > 14 static_assert((noexcept(C{})), "" ); @@ -45,8 +44,7 @@ } template -void -test1(const typename C::allocator_type& a) +TEST_CONSTEXPR_CXX20 void test1(const typename C::allocator_type& a) { #if TEST_STD_VER > 14 static_assert((noexcept(C{typename C::allocator_type{}})), "" ); @@ -60,8 +58,7 @@ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); } -int main(int, char**) -{ +TEST_CONSTEXPR_CXX20 bool tests() { { test0 >(); test0 >(); @@ -99,5 +96,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp @@ -44,7 +44,7 @@ } } -static void basic_test_cases() { +TEST_CONSTEXPR_CXX20 void basic_test_cases() { int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0}; int* an = a + sizeof(a) / sizeof(a[0]); test >(cpp17_input_iterator(a), @@ -84,7 +84,7 @@ #endif } -void emplaceable_concept_tests() { +TEST_CONSTEXPR_CXX20 void emplaceable_concept_tests() { #if TEST_STD_VER >= 11 int arr1[] = {42}; int arr2[] = {1, 101, 42}; @@ -123,7 +123,7 @@ #endif } -void test_ctor_under_alloc() { +TEST_CONSTEXPR_CXX20 void test_ctor_under_alloc() { #if TEST_STD_VER >= 11 int arr1[] = {42}; int arr2[] = {1, 101, 42}; @@ -160,7 +160,7 @@ struct Der : B1, B2 { int z; }; // Initialize a vector with a different value type. -void test_ctor_with_different_value_type() { +TEST_CONSTEXPR_CXX20 void test_ctor_with_different_value_type() { { // Make sure initialization is performed with each element value, not with // a memory blob. @@ -189,12 +189,20 @@ } } - -int main(int, char**) { +TEST_CONSTEXPR_CXX20 bool tests() { basic_test_cases(); emplaceable_concept_tests(); // See PR34898 test_ctor_under_alloc(); test_ctor_with_different_value_type(); - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp @@ -21,6 +21,7 @@ #include "asan_testing.h" template +TEST_CONSTEXPR_CXX20 void test(typename C::size_type n, typename C::allocator_type const& a = typename C::allocator_type()) { @@ -52,7 +53,7 @@ #endif } -void tests() { +TEST_CONSTEXPR_CXX20 bool tests() { test >(0); test >(50); test >(0); @@ -69,7 +70,13 @@ #endif } + return true; +} + int main(int, char**) { tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp @@ -19,7 +19,7 @@ #include "asan_testing.h" template -void +TEST_CONSTEXPR_CXX20 void test(typename C::size_type n, const typename C::value_type& x) { C c(n, x); @@ -30,8 +30,7 @@ assert(*i == x); } -int main(int, char**) -{ +TEST_CONSTEXPR_CXX20 bool tests() { test >(0, 3); test >(50, 3); // Add 1 for implementations that dynamically allocate a container proxy. @@ -43,5 +42,14 @@ test> >(50, 3); #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp @@ -18,7 +18,7 @@ #include "asan_testing.h" template -void +TEST_CONSTEXPR_CXX20 void test(typename C::size_type n, const typename C::value_type& x, const typename C::allocator_type& a) { @@ -31,8 +31,7 @@ assert(*i == x); } -int main(int, char**) -{ +TEST_CONSTEXPR_CXX20 bool tests() { test >(0, 3, std::allocator()); test >(50, 3, std::allocator()); #if TEST_STD_VER >= 11 @@ -40,5 +39,14 @@ test> >(50, 3, min_allocator()); #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp @@ -19,7 +19,7 @@ #include "asan_testing.h" template -void +TEST_CONSTEXPR_CXX20 void test(const C& x) { typename C::size_type s = x.size(); @@ -30,8 +30,7 @@ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); } -int main(int, char**) -{ +TEST_CONSTEXPR_CXX20 bool tests() { { int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0}; int* an = a + sizeof(a)/sizeof(a[0]); @@ -87,5 +86,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp @@ -30,8 +30,7 @@ LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); } -int main(int, char**) -{ +TEST_CONSTEXPR_CXX20 bool tests() { { int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0}; int* an = a + sizeof(a)/sizeof(a[0]); @@ -71,5 +70,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/deduct.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/deduct.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/deduct.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/deduct.pass.cpp @@ -28,8 +28,7 @@ struct A {}; -int main(int, char**) -{ +TEST_CONSTEXPR_CXX20 bool tests() { // Test the explicit deduction guides { @@ -145,3 +144,11 @@ return 0; } + +int main(int, char**) { + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; +} diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/default.recursive.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/default.recursive.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/default.recursive.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/default.recursive.pass.cpp @@ -22,5 +22,5 @@ int main(int, char**) { - return 0; + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp @@ -30,8 +30,7 @@ void allocate(size_t); }; -int main(int, char**) -{ +TEST_CONSTEXPR_CXX20 bool tests() { { typedef std::vector C; static_assert(std::is_nothrow_default_constructible::value, ""); @@ -49,5 +48,14 @@ static_assert(!std::is_nothrow_default_constructible::value, ""); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp @@ -28,7 +28,7 @@ void allocate(size_t); }; -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { typedef std::vector C; @@ -49,5 +49,14 @@ } #endif // _LIBCPP_VERSION - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp @@ -18,7 +18,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector d = {3, 4, 5, 6}; @@ -39,5 +39,14 @@ assert(d[3] == 6); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp @@ -20,7 +20,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector> d({3, 4, 5, 6}, test_allocator(3)); @@ -49,5 +49,14 @@ assert(is_contiguous_container_asan_correct(d)); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/move.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/move.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/move.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/move.pass.cpp @@ -21,7 +21,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { test_allocator_statistics alloc_stats; { @@ -131,5 +131,14 @@ } } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp @@ -20,7 +20,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector > l(test_allocator(5)); @@ -95,5 +95,14 @@ assert(is_contiguous_container_asan_correct(l2)); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp @@ -96,5 +96,5 @@ } #endif - return 0; + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector d; @@ -42,5 +42,14 @@ assert(d[3] == 6); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.data/data.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.data/data.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.data/data.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.data/data.pass.cpp @@ -18,15 +18,15 @@ #include "asan_testing.h" struct Nasty { - Nasty() : i_(0) {} - Nasty(int i) : i_(i) {} - ~Nasty() {} + TEST_CONSTEXPR Nasty() : i_(0) {} + TEST_CONSTEXPR Nasty(int i) : i_(i) {} + TEST_CONSTEXPR ~Nasty() {} Nasty * operator&() const { assert(false); return nullptr; } int i_; - }; +}; -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector v; @@ -61,5 +61,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp @@ -18,15 +18,15 @@ #include "asan_testing.h" struct Nasty { - Nasty() : i_(0) {} - Nasty(int i) : i_(i) {} - ~Nasty() {} + TEST_CONSTEXPR Nasty() : i_(0) {} + TEST_CONSTEXPR Nasty(int i) : i_(i) {} + TEST_CONSTEXPR ~Nasty() {} Nasty * operator&() const { assert(false); return nullptr; } int i_; - }; +}; -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { const std::vector v; @@ -61,5 +61,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.erasure/erase.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.erasure/erase.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.erasure/erase.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.erasure/erase.pass.cpp @@ -21,16 +21,15 @@ #include "min_allocator.h" template -void test0(S s, U val, S expected, size_t expected_erased_count) { +TEST_CONSTEXPR_CXX20 void test0(S s, U val, S expected, size_t expected_erased_count) { ASSERT_SAME_TYPE(typename S::size_type, decltype(std::erase(s, val))); assert(expected_erased_count == std::erase(s, val)); assert(s == expected); } template -void test() +TEST_CONSTEXPR_CXX20 void test() { - test0(S(), 1, S(), 0); test0(S({1}), 1, S(), 1); @@ -64,7 +63,7 @@ test0(S({1, 2, 1}), opt(3), S({1, 2, 1}), 0); } -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { test>(); test>> (); @@ -73,5 +72,14 @@ test>(); test>(); + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.erasure/erase_if.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.erasure/erase_if.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.erasure/erase_if.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.erasure/erase_if.pass.cpp @@ -20,14 +20,14 @@ #include "min_allocator.h" template -void test0(S s, Pred p, S expected, size_t expected_erased_count) { +TEST_CONSTEXPR_CXX20 void test0(S s, Pred p, S expected, size_t expected_erased_count) { ASSERT_SAME_TYPE(typename S::size_type, decltype(std::erase_if(s, p))); assert(expected_erased_count == std::erase_if(s, p)); assert(s == expected); } template -void test() +TEST_CONSTEXPR_CXX20 void test() { auto is1 = [](auto v) { return v == 1;}; auto is2 = [](auto v) { return v == 2;}; @@ -65,7 +65,7 @@ test0(S({1, 2, 3}), False, S({1, 2, 3}), 0); } -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { test>(); test>> (); @@ -74,5 +74,14 @@ test>(); test>(); - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp @@ -17,7 +17,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { int a[] = {1, 2, 3}; @@ -40,5 +40,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp @@ -28,10 +28,10 @@ A(const A&); A& operator=(const A&); public: - A(int i, double d) + TEST_CONSTEXPR_CXX14 A(int i, double d) : i_(i), d_(d) {} - A(A&& a) + TEST_CONSTEXPR_CXX14 A(A&& a) : i_(a.i_), d_(a.d_) { @@ -39,7 +39,7 @@ a.d_ = 0; } - A& operator=(A&& a) + TEST_CONSTEXPR_CXX14 A& operator=(A&& a) { i_ = a.i_; d_ = a.d_; @@ -48,11 +48,11 @@ return *this; } - int geti() const {return i_;} - double getd() const {return d_;} + TEST_CONSTEXPR_CXX14 int geti() const {return i_;} + TEST_CONSTEXPR_CXX14 double getd() const {return d_;} }; -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector c; @@ -133,5 +133,14 @@ assert(c.back().getd() == 4.5); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp @@ -29,10 +29,10 @@ A(const A&); A& operator=(const A&); public: - A(int i, double d) + TEST_CONSTEXPR_CXX14 A(int i, double d) : i_(i), d_(d) {} - A(A&& a) + TEST_CONSTEXPR_CXX14 A(A&& a) : i_(a.i_), d_(a.d_) { @@ -40,7 +40,7 @@ a.d_ = 0; } - A& operator=(A&& a) + TEST_CONSTEXPR_CXX14 A& operator=(A&& a) { i_ = a.i_; d_ = a.d_; @@ -49,11 +49,11 @@ return *this; } - int geti() const {return i_;} - double getd() const {return d_;} + TEST_CONSTEXPR_CXX14 int geti() const {return i_;} + TEST_CONSTEXPR_CXX14 double getd() const {return d_;} }; -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector c; @@ -156,5 +156,14 @@ for (int i = 0; i < sz; ++i) assert(c[i] == i); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp @@ -19,8 +19,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) -{ +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector v; v.reserve(3); @@ -71,5 +70,14 @@ assert(v.capacity() == old_capacity); assert(v[4] == 42); } - return 0; + + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp @@ -33,7 +33,7 @@ bool Throws::sThrows = false; #endif -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { int a1[] = {1, 2, 3, 4, 5}; @@ -116,5 +116,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp @@ -33,7 +33,7 @@ bool Throws::sThrows = false; #endif -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { int a1[] = {1, 2, 3}; { @@ -154,5 +154,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector d(10, 1); @@ -64,5 +64,14 @@ assert(d[13] == 1); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp @@ -26,7 +26,7 @@ void make_move_iterator(S*) {} } -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { typedef std::vector V; @@ -182,5 +182,14 @@ s.insert(s.end(), cpp17_input_iterator(nullptr), cpp17_input_iterator(nullptr)); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp @@ -21,7 +21,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector v(100); @@ -63,5 +63,14 @@ assert(v[j] == MoveOnly()); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector v(100); @@ -112,5 +112,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp @@ -18,7 +18,7 @@ #include "min_allocator.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector c; @@ -50,5 +50,14 @@ assert(c[i] == i); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp @@ -18,7 +18,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector c; @@ -110,5 +110,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp @@ -21,7 +21,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { std::vector c; @@ -111,5 +111,14 @@ assert(c[j] == MoveOnly(j)); } - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.special/swap.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.special/swap.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.special/swap.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.special/swap.pass.cpp @@ -19,7 +19,7 @@ #include "min_allocator.h" #include "asan_testing.h" -int main(int, char**) +TEST_CONSTEXPR_CXX20 bool tests() { { int a1[] = {1, 3, 7, 9, 10}; @@ -180,5 +180,14 @@ } #endif - return 0; + return true; +} + +int main(int, char**) +{ + tests(); +#if TEST_STD_VER > 17 + static_assert(tests()); +#endif + return 0; } diff --git a/libcxx/test/support/DefaultOnly.h b/libcxx/test/support/DefaultOnly.h --- a/libcxx/test/support/DefaultOnly.h +++ b/libcxx/test/support/DefaultOnly.h @@ -6,29 +6,28 @@ // //===----------------------------------------------------------------------===// -#ifndef DEFAULTONLY_H -#define DEFAULTONLY_H +#ifndef TEST_SUPPORT_DEFAULT_ONLY_H +#define TEST_SUPPORT_DEFAULT_ONLY_H #include -class DefaultOnly -{ +#include "test_macros.h" + +class DefaultOnly { int data_; DefaultOnly(const DefaultOnly&); DefaultOnly& operator=(const DefaultOnly&); public: - static int count; - - DefaultOnly() : data_(-1) {++count;} - ~DefaultOnly() {data_ = 0; --count;} + TEST_CONSTEXPR DefaultOnly() : data_(-1) { } + TEST_CONSTEXPR ~DefaultOnly() { data_ = 0; } - friend bool operator==(const DefaultOnly& x, const DefaultOnly& y) - {return x.data_ == y.data_;} - friend bool operator< (const DefaultOnly& x, const DefaultOnly& y) - {return x.data_ < y.data_;} + TEST_CONSTEXPR friend bool operator==(const DefaultOnly& x, const DefaultOnly& y) + {return x.data_ == y.data_;} + TEST_CONSTEXPR friend bool operator< (const DefaultOnly& x, const DefaultOnly& y) + {return x.data_ < y.data_;} }; int DefaultOnly::count = 0; -#endif // DEFAULTONLY_H +#endif // TEST_SUPPORT_DEFAULT_ONLY_H diff --git a/libcxx/test/support/asan_testing.h b/libcxx/test/support/asan_testing.h --- a/libcxx/test/support/asan_testing.h +++ b/libcxx/test/support/asan_testing.h @@ -16,17 +16,19 @@ ( const void *beg, const void *mid, const void *end ); template -bool is_contiguous_container_asan_correct ( const std::vector &c ) +constexpr bool is_contiguous_container_asan_correct ( const std::vector &c ) { - if ( std::is_same >::value && c.data() != NULL) - return __sanitizer_verify_contiguous_container ( + if (std::__libcpp_is_constant_evaluated()) + return true; + if (std::is_same >::value && c.data() != NULL) + return __sanitizer_verify_contiguous_container( c.data(), c.data() + c.size(), c.data() + c.capacity()) != 0; return true; } #else template -bool is_contiguous_container_asan_correct ( const std::vector &) +constexpr bool is_contiguous_container_asan_correct ( const std::vector &) { return true; } diff --git a/libcxx/test/support/test_allocator.h b/libcxx/test/support/test_allocator.h --- a/libcxx/test/support/test_allocator.h +++ b/libcxx/test/support/test_allocator.h @@ -21,7 +21,7 @@ #include "test_macros.h" template -inline typename std::allocator_traits::size_type alloc_max_size(Alloc const& a) { +TEST_CONSTEXPR_CXX20 inline typename std::allocator_traits::size_type alloc_max_size(Alloc const& a) { typedef std::allocator_traits AT; return AT::max_size(a); }