diff --git a/libcxx/include/__iterator/move_iterator.h b/libcxx/include/__iterator/move_iterator.h --- a/libcxx/include/__iterator/move_iterator.h +++ b/libcxx/include/__iterator/move_iterator.h @@ -79,17 +79,12 @@ typedef typename iterator_traits::difference_type difference_type; typedef iterator_type pointer; -#ifndef _LIBCPP_CXX03_LANG typedef typename iterator_traits::reference __reference; typedef typename conditional< is_reference<__reference>::value, typename remove_reference<__reference>::type&&, __reference >::type reference; -#else - typedef typename iterator_traits::reference reference; -#endif - #endif // _LIBCPP_STD_VER > 17 #if _LIBCPP_STD_VER > 17 diff --git a/libcxx/include/__utility/move.h b/libcxx/include/__utility/move.h --- a/libcxx/include/__utility/move.h +++ b/libcxx/include/__utility/move.h @@ -26,15 +26,10 @@ return static_cast<_Up&&>(__t); } -#ifndef _LIBCPP_CXX03_LANG template using __move_if_noexcept_result_t = typename conditional::value && is_copy_constructible<_Tp>::value, const _Tp&, _Tp&&>::type; -#else // _LIBCPP_CXX03_LANG -template -using __move_if_noexcept_result_t = const _Tp&; -#endif template _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __move_if_noexcept_result_t<_Tp> diff --git a/libcxx/include/vector b/libcxx/include/vector --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -434,10 +434,15 @@ _LIBCPP_INLINE_VISIBILITY vector(initializer_list __il, const allocator_type& __a); + _LIBCPP_INLINE_VISIBILITY + vector& operator=(initializer_list __il) + {assign(__il.begin(), __il.end()); return *this;} +#endif // !_LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY vector(vector&& __x) #if _LIBCPP_STD_VER > 14 - _NOEXCEPT; + noexcept; #else _NOEXCEPT_(is_nothrow_move_constructible::value); #endif @@ -448,12 +453,6 @@ vector& operator=(vector&& __x) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); - _LIBCPP_INLINE_VISIBILITY - vector& operator=(initializer_list __il) - {assign(__il.begin(), __il.end()); return *this;} - -#endif // !_LIBCPP_CXX03_LANG - template typename enable_if < @@ -565,41 +564,26 @@ const value_type* data() const _NOEXCEPT {return _VSTD::__to_address(this->__begin_);} -#ifdef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - void __emplace_back(const value_type& __x) { push_back(__x); } -#else - template - _LIBCPP_INLINE_VISIBILITY - void __emplace_back(_Arg&& __arg) { - emplace_back(_VSTD::forward<_Arg>(__arg)); - } -#endif - _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); -#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void push_back(value_type&& __x); template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY #if _LIBCPP_STD_VER > 14 reference emplace_back(_Args&&... __args); #else void emplace_back(_Args&&... __args); #endif -#endif // !_LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void pop_back(); iterator insert(const_iterator __position, const_reference __x); -#ifndef _LIBCPP_CXX03_LANG iterator insert(const_iterator __position, value_type&& __x); template - iterator emplace(const_iterator __position, _Args&&... __args); -#endif // !_LIBCPP_CXX03_LANG + iterator emplace(const_iterator __position, _Args&&... __args); iterator insert(const_iterator __position, size_type __n, const_reference __x); template @@ -724,7 +708,6 @@ __annotate_shrink(__old_size); } -#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY inline void __push_back_slow_path(_Up&& __x); @@ -732,11 +715,6 @@ template _LIBCPP_INLINE_VISIBILITY inline void __emplace_back_slow_path(_Args&&... __args); -#else - template - _LIBCPP_INLINE_VISIBILITY - inline void __push_back_slow_path(_Up& __x); -#endif // The following functions are no-ops outside of AddressSanitizer mode. // We call annotatations only for the default Allocator because other allocators @@ -1110,7 +1088,7 @@ { _VSTD::__debug_db_insert_c(this); for (; __first != __last; ++__first) - __emplace_back(*__first); + emplace_back(*__first); } template @@ -1125,7 +1103,7 @@ { _VSTD::__debug_db_insert_c(this); for (; __first != __last; ++__first) - __emplace_back(*__first); + emplace_back(*__first); } template @@ -1190,13 +1168,11 @@ } } -#ifndef _LIBCPP_CXX03_LANG - template inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>::vector(vector&& __x) #if _LIBCPP_STD_VER > 14 - _NOEXCEPT + noexcept #else _NOEXCEPT_(is_nothrow_move_constructible::value) #endif @@ -1231,6 +1207,8 @@ } } +#ifndef _LIBCPP_CXX03_LANG + template inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>::vector(initializer_list __il) @@ -1256,6 +1234,8 @@ } } +#endif // _LIBCPP_CXX03_LANG + template inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>& @@ -1295,8 +1275,6 @@ std::__debug_db_swap(this, std::addressof(__c)); } -#endif // !_LIBCPP_CXX03_LANG - template inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>& @@ -1325,7 +1303,7 @@ { clear(); for (; __first != __last; ++__first) - __emplace_back(*__first); + emplace_back(*__first); } template @@ -1519,11 +1497,7 @@ template template void -#ifndef _LIBCPP_CXX03_LANG vector<_Tp, _Allocator>::__push_back_slow_path(_Up&& __x) -#else -vector<_Tp, _Allocator>::__push_back_slow_path(_Up& __x) -#endif { allocator_type& __a = this->__alloc(); __split_buffer __v(__recommend(size() + 1), size(), __a); @@ -1546,8 +1520,6 @@ __push_back_slow_path(__x); } -#ifndef _LIBCPP_CXX03_LANG - template inline _LIBCPP_INLINE_VISIBILITY void @@ -1595,8 +1567,6 @@ #endif } -#endif // !_LIBCPP_CXX03_LANG - template inline void @@ -1693,8 +1663,6 @@ return __make_iter(__p); } -#ifndef _LIBCPP_CXX03_LANG - template typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x) @@ -1755,8 +1723,6 @@ return __make_iter(__p); } -#endif // !_LIBCPP_CXX03_LANG - template typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x) @@ -2125,10 +2091,16 @@ vector(initializer_list __il); vector(initializer_list __il, const allocator_type& __a); + _LIBCPP_INLINE_VISIBILITY + vector& operator=(initializer_list __il) + {assign(__il.begin(), __il.end()); return *this;} + +#endif // !_LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY vector(vector&& __v) #if _LIBCPP_STD_VER > 14 - _NOEXCEPT; + noexcept; #else _NOEXCEPT_(is_nothrow_move_constructible::value); #endif @@ -2137,12 +2109,6 @@ vector& operator=(vector&& __v) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); - _LIBCPP_INLINE_VISIBILITY - vector& operator=(initializer_list __il) - {assign(__il.begin(), __il.end()); return *this;} - -#endif // !_LIBCPP_CXX03_LANG - template typename enable_if < @@ -2739,8 +2705,6 @@ return *this; } -#ifndef _LIBCPP_CXX03_LANG - template inline _LIBCPP_INLINE_VISIBILITY vector::vector(vector&& __v) #if _LIBCPP_STD_VER > 14 @@ -2812,8 +2776,6 @@ __c.__cap() = __c.__size_ = 0; } -#endif // !_LIBCPP_CXX03_LANG - template void vector::assign(size_type __n, const value_type& __x) diff --git a/libcxx/test/std/containers/sequences/array/array.creation/to_array.fail.cpp b/libcxx/test/std/containers/sequences/array/array.creation/to_array.fail.cpp --- a/libcxx/test/std/containers/sequences/array/array.creation/to_array.fail.cpp +++ b/libcxx/test/std/containers/sequences/array/array.creation/to_array.fail.cpp @@ -28,14 +28,14 @@ { MoveOnly mo[] = {MoveOnly{3}}; // expected-error@array:* {{to_array requires copy constructible elements}} - // expected-error@array:* {{call to implicitly-deleted copy constructor of 'MoveOnly'}} + // expected-error-re@array:* {{{{(call to implicitly-deleted copy constructor of 'MoveOnly')|(call to deleted constructor of 'MoveOnly')}}}} std::to_array(mo); // expected-note {{requested here}} } { const MoveOnly cmo[] = {MoveOnly{3}}; // expected-error@array:* {{to_array requires move constructible elements}} - // expected-error@array:* {{call to implicitly-deleted copy constructor of 'MoveOnly'}} + // expected-error-re@array:* {{{{(call to implicitly-deleted copy constructor of 'MoveOnly')|(call to deleted constructor of 'MoveOnly')}}}} std::to_array(std::move(cmo)); // expected-note {{requested here}} } 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 @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03 +// UNSUPPORTED: c++03 && !stdlib=libc++ // @@ -78,8 +78,8 @@ assert(is_contiguous_container_asan_correct(l2)); } { - std::vector > l(min_allocator{}); - std::vector > lo(min_allocator{}); + std::vector > l((min_allocator())); + std::vector > lo((min_allocator())); assert(is_contiguous_container_asan_correct(l)); assert(is_contiguous_container_asan_correct(lo)); for (int i = 1; i <= 3; ++i) @@ -89,7 +89,7 @@ } assert(is_contiguous_container_asan_correct(l)); assert(is_contiguous_container_asan_correct(lo)); - std::vector > l2(min_allocator{}); + std::vector > l2((min_allocator())); l2 = std::move(l); assert(l2 == lo); assert(l.empty()); diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/copy.move_only.verify.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/copy.move_only.verify.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/copy.move_only.verify.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/copy.move_only.verify.cpp @@ -8,20 +8,15 @@ // Make sure that a std::vector containing move-only types can't be copied. -// UNSUPPORTED: c++03 +// UNSUPPORTED: c++03 && !stdlib=libc++ #include -struct move_only -{ - move_only() = default; - move_only(move_only&&) = default; - move_only& operator=(move_only&&) = default; -}; +#include "MoveOnly.h" int main(int, char**) { - std::vector v; - std::vector copy = v; // expected-error-re@* {{{{(no matching function for call to 'construct_at')|(call to implicitly-deleted copy constructor of 'move_only')}}}} + std::vector v; + std::vector copy = v; // expected-error-re@* {{{{(no matching function for call to 'construct_at')|(call to implicitly-deleted copy constructor of 'MoveOnly')|(call to deleted constructor of 'MoveOnly')}}}} return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/move.addressof.compile.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/move.addressof.compile.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.cons/move.addressof.compile.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/move.addressof.compile.pass.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03 +// UNSUPPORTED: c++03 && !stdlib=libc++ // @@ -21,11 +21,11 @@ void test() { { - std::vector vo{}; - std::vector v{std::move(vo)}; + std::vector vo; + std::vector v(std::move(vo)); } { - std::vector vo{}; - std::vector v{std::move(vo), std::allocator{}}; + std::vector vo; + std::vector v(std::move(vo), std::allocator()); } } 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 @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03 +// UNSUPPORTED: c++03 && !stdlib=libc++ // @@ -72,8 +72,8 @@ assert(is_contiguous_container_asan_correct(c2)); } { - std::vector > l(min_allocator{}); - std::vector > lo(min_allocator{}); + std::vector > l((min_allocator())); + std::vector > lo((min_allocator())); assert(is_contiguous_container_asan_correct(l)); assert(is_contiguous_container_asan_correct(lo)); for (int i = 1; i <= 3; ++i) @@ -91,12 +91,12 @@ } { int a1[] = {1, 3, 7, 9, 10}; - std::vector> c1(a1, a1+sizeof(a1)/sizeof(a1[0])); + std::vector > c1(a1, a1+sizeof(a1)/sizeof(a1[0])); assert(is_contiguous_container_asan_correct(c1)); - std::vector>::const_iterator i = c1.begin(); - std::vector> c2 = std::move(c1); + std::vector >::const_iterator i = c1.begin(); + std::vector > c2 = std::move(c1); assert(is_contiguous_container_asan_correct(c2)); - std::vector>::iterator j = c2.erase(i); + std::vector >::iterator j = c2.erase(i); assert(*j == 3); assert(is_contiguous_container_asan_correct(c2)); } 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 @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03 +// UNSUPPORTED: c++03 && !stdlib=libc++ // @@ -77,8 +77,8 @@ assert(is_contiguous_container_asan_correct(l2)); } { - std::vector > l(min_allocator{}); - std::vector > lo(min_allocator{}); + std::vector > l((min_allocator())); + std::vector > lo((min_allocator())); assert(is_contiguous_container_asan_correct(l)); assert(is_contiguous_container_asan_correct(lo)); for (int i = 1; i <= 3; ++i) diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace.addressof.compile.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace.addressof.compile.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace.addressof.compile.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace.addressof.compile.pass.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03 +// UNSUPPORTED: c++03 && !stdlib=libc++ // 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 @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03 +// UNSUPPORTED: c++03 && !stdlib=libc++ // @@ -109,8 +109,8 @@ assert(is_contiguous_container_asan_correct(c)); } { - std::vector> c; - std::vector>::iterator i = c.emplace(c.cbegin(), 2, 3.5); + std::vector > c; + std::vector >::iterator i = c.emplace(c.cbegin(), 2, 3.5); assert(i == c.begin()); assert(c.size() == 1); assert(c.front().geti() == 2); 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 @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03 +// UNSUPPORTED: c++03 && !stdlib=libc++ // @@ -26,9 +26,10 @@ int i_; double d_; - A(const A&); - A& operator=(const A&); public: + A(const A&) = delete; + A& operator=(const A&) = delete; + A(int i, double d) : i_(i), d_(d) {} @@ -110,7 +111,7 @@ assert(is_contiguous_container_asan_correct(c)); } { - std::vector> c; + std::vector > c; #if TEST_STD_VER > 14 A& r1 = c.emplace_back(2, 3.5); assert(c.size() == 1); @@ -137,7 +138,7 @@ assert(is_contiguous_container_asan_correct(c)); } { - std::vector> c; + std::vector > c; c.emplace_back(); assert(c.size() == 1); c.emplace_back(1, 2, 3); diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.addressof.compile.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.addressof.compile.pass.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.addressof.compile.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.addressof.compile.pass.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03 +// UNSUPPORTED: c++03 && !stdlib=libc++ // @@ -21,5 +21,5 @@ void test() { std::vector v; - v.insert(v.end(), operator_hijacker{}); + v.insert(v.end(), operator_hijacker()); } 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 @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03 +// UNSUPPORTED: c++03 && !stdlib=libc++ // @@ -50,8 +50,8 @@ assert(v[j] == MoveOnly()); } { - std::vector> v(100); - std::vector>::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3)); + std::vector > v(100); + std::vector >::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3)); assert(v.size() == 101); assert(is_contiguous_container_asan_correct(v)); assert(i == v.begin() + 10); 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 @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03 +// UNSUPPORTED: c++03 && !stdlib=libc++ // @@ -83,7 +83,7 @@ assert(c[j] == MoveOnly(j)); } { - std::vector> c; + std::vector > c; c.push_back(MoveOnly(0)); assert(c.size() == 1); assert(is_contiguous_container_asan_correct(c)); diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.fail.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.fail.cpp --- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.fail.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.fail.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03 +// UNSUPPORTED: c++03 && !stdlib=libc++ // @@ -40,7 +40,7 @@ x.emplace_back(); } { - std::vector> x; + std::vector > x; BadUserNoCookie<2> c; x.push_back(c); } diff --git a/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp b/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp @@ -49,11 +49,7 @@ static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); -#if TEST_STD_VER >= 11 static_assert((std::is_same::value), ""); -#else - static_assert((std::is_same::value), ""); -#endif #if TEST_STD_VER > 17 if constexpr (std::is_same_v) { static_assert((std::is_same::value), ""); diff --git a/libcxx/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp b/libcxx/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp --- a/libcxx/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp +++ b/libcxx/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++03 && !stdlib=libc++ + // // template @@ -46,20 +48,11 @@ A a; const A ca; -#if TEST_STD_VER >= 11 static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); -#else // C++ < 11 - // In C++03 we don't have noexcept so we can never move :-( - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); -#endif #if TEST_STD_VER > 11 constexpr int i1 = 23; diff --git a/libcxx/test/support/MoveOnly.h b/libcxx/test/support/MoveOnly.h --- a/libcxx/test/support/MoveOnly.h +++ b/libcxx/test/support/MoveOnly.h @@ -11,8 +11,6 @@ #include "test_macros.h" -#if TEST_STD_VER >= 11 - #include #include @@ -20,31 +18,35 @@ { int data_; public: - constexpr MoveOnly(int data = 1) : data_(data) {} + TEST_CONSTEXPR MoveOnly(int data = 1) : data_(data) {} + + MoveOnly(const MoveOnly&) = delete; + MoveOnly& operator=(const MoveOnly&) = delete; + TEST_CONSTEXPR_CXX14 MoveOnly(MoveOnly&& x) : data_(x.data_) {x.data_ = 0;} TEST_CONSTEXPR_CXX14 MoveOnly& operator=(MoveOnly&& x) {data_ = x.data_; x.data_ = 0; return *this;} - constexpr int get() const {return data_;} + TEST_CONSTEXPR int get() const {return data_;} - friend constexpr bool operator==(const MoveOnly& x, const MoveOnly& y) + friend TEST_CONSTEXPR bool operator==(const MoveOnly& x, const MoveOnly& y) { return x.data_ == y.data_; } - friend constexpr bool operator!=(const MoveOnly& x, const MoveOnly& y) + friend TEST_CONSTEXPR bool operator!=(const MoveOnly& x, const MoveOnly& y) { return x.data_ != y.data_; } - friend constexpr bool operator< (const MoveOnly& x, const MoveOnly& y) + friend TEST_CONSTEXPR bool operator< (const MoveOnly& x, const MoveOnly& y) { return x.data_ < y.data_; } - friend constexpr bool operator<=(const MoveOnly& x, const MoveOnly& y) + friend TEST_CONSTEXPR bool operator<=(const MoveOnly& x, const MoveOnly& y) { return x.data_ <= y.data_; } - friend constexpr bool operator> (const MoveOnly& x, const MoveOnly& y) + friend TEST_CONSTEXPR bool operator> (const MoveOnly& x, const MoveOnly& y) { return x.data_ > y.data_; } - friend constexpr bool operator>=(const MoveOnly& x, const MoveOnly& y) + friend TEST_CONSTEXPR bool operator>=(const MoveOnly& x, const MoveOnly& y) { return x.data_ >= y.data_; } TEST_CONSTEXPR_CXX14 MoveOnly operator+(const MoveOnly& x) const - { return MoveOnly{data_ + x.data_}; } + { return MoveOnly(data_ + x.data_); } TEST_CONSTEXPR_CXX14 MoveOnly operator*(const MoveOnly& x) const - { return MoveOnly{data_ * x.data_}; } + { return MoveOnly(data_ * x.data_); } template friend void operator,(T t, U u) = delete; @@ -56,9 +58,7 @@ { typedef MoveOnly argument_type; typedef size_t result_type; - constexpr size_t operator()(const MoveOnly& x) const {return x.get();} + TEST_CONSTEXPR size_t operator()(const MoveOnly& x) const {return x.get();} }; -#endif // TEST_STD_VER >= 11 - #endif // MOVEONLY_H 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 @@ -112,7 +112,6 @@ } } -#if TEST_STD_VER >= 11 TEST_CONSTEXPR_CXX14 test_allocator(test_allocator&& a) TEST_NOEXCEPT : data_(a.data_), id_(a.id_), stats_(a.stats_) { if (stats_ != nullptr) { ++stats_->count; @@ -123,7 +122,6 @@ a.data_ = test_alloc_base::moved_value; a.id_ = test_alloc_base::moved_value; } -#endif template TEST_CONSTEXPR_CXX14 test_allocator(const test_allocator& a) TEST_NOEXCEPT @@ -166,14 +164,11 @@ TEST_CONSTEXPR size_type max_size() const TEST_NOEXCEPT { return UINT_MAX / sizeof(T); } -#if TEST_STD_VER < 11 - void construct(pointer p, const T& val) { ::new (static_cast(p)) T(val); } -#else template TEST_CONSTEXPR_CXX14 void construct(pointer p, U&& val) { ::new (static_cast(p)) T(std::forward(val)); } -#endif + TEST_CONSTEXPR_CXX14 void destroy(pointer p) { p->~T(); } TEST_CONSTEXPR friend bool operator==(const test_allocator& x, const test_allocator& y) { return x.data_ == y.data_; } TEST_CONSTEXPR friend bool operator!=(const test_allocator& x, const test_allocator& y) { return !(x == y); } @@ -358,8 +353,6 @@ #endif }; -#if TEST_STD_VER >= 11 - struct Ctor_Tag {}; template @@ -369,15 +362,15 @@ // All constructors must be passed the Tag type. // DefaultInsertable into vector>, - constexpr Tag_X(Ctor_Tag) {} + TEST_CONSTEXPR Tag_X(Ctor_Tag) {} // CopyInsertable into vector>, - constexpr Tag_X(Ctor_Tag, const Tag_X&) {} + TEST_CONSTEXPR Tag_X(Ctor_Tag, const Tag_X&) {} // MoveInsertable into vector>, and - constexpr Tag_X(Ctor_Tag, Tag_X&&) {} + TEST_CONSTEXPR Tag_X(Ctor_Tag, Tag_X&&) {} // EmplaceConstructible into vector> from args. template - constexpr Tag_X(Ctor_Tag, Args&&...) {} + TEST_CONSTEXPR Tag_X(Ctor_Tag, Args&&...) {} // not DefaultConstructible, CopyConstructible or MoveConstructible. Tag_X() = delete; @@ -403,11 +396,11 @@ TaggingAllocator() = default; template - constexpr TaggingAllocator(const TaggingAllocator&){}; + TEST_CONSTEXPR TaggingAllocator(const TaggingAllocator&) {} template void construct(Tag_X* p, Args&&... args) { - ::new ((void*)p) Tag_X(Ctor_Tag{}, std::forward(args)...); + ::new ((void*)p) Tag_X(Ctor_Tag(), std::forward(args)...); } template @@ -415,10 +408,9 @@ p->~U(); } - TEST_CONSTEXPR_CXX20 T* allocate(std::size_t n) { return std::allocator{}.allocate(n); } - TEST_CONSTEXPR_CXX20 void deallocate(T* p, std::size_t n) { std::allocator{}.deallocate(p, n); } + TEST_CONSTEXPR_CXX20 T* allocate(std::size_t n) { return std::allocator().allocate(n); } + TEST_CONSTEXPR_CXX20 void deallocate(T* p, std::size_t n) { std::allocator().deallocate(p, n); } }; -#endif template struct limited_alloc_handle {