Author: marshall Date: Wed Nov 2 10:30:26 2016 New Revision: 285818 URL: http://llvm.org/viewvc/llvm-project?rev=285818&view=rev Log: Implement another part of P0031; adding constexpr to move_iterator
Modified: libcxx/trunk/include/iterator libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+/difference_type.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+=/difference_type.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-=/difference_type.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp Modified: libcxx/trunk/include/iterator URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iterator?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/include/iterator (original) +++ libcxx/trunk/include/iterator Wed Nov 2 10:30:26 2016 @@ -219,61 +219,64 @@ public: typedef typename iterator_traits<Iterator>::iterator_category iterator_category; typedef value_type&& reference; - move_iterator(); - explicit move_iterator(Iterator i); - template <class U> move_iterator(const move_iterator<U>& u); - template <class U> move_iterator& operator=(const move_iterator<U>& u); - iterator_type base() const; - reference operator*() const; - pointer operator->() const; - move_iterator& operator++(); - move_iterator operator++(int); - move_iterator& operator--(); - move_iterator operator--(int); - move_iterator operator+(difference_type n) const; - move_iterator& operator+=(difference_type n); - move_iterator operator-(difference_type n) const; - move_iterator& operator-=(difference_type n); - unspecified operator[](difference_type n) const; + constexpr move_iterator(); // all the constexprs are in C++17 + constexpr explicit move_iterator(Iterator i); + template <class U> + constexpr move_iterator(const move_iterator<U>& u); + template <class U> + constexpr move_iterator& operator=(const move_iterator<U>& u); + constexpr iterator_type base() const; + constexpr reference operator*() const; + constexpr pointer operator->() const; + constexpr move_iterator& operator++(); + constexpr move_iterator operator++(int); + constexpr move_iterator& operator--(); + constexpr move_iterator operator--(int); + constexpr move_iterator operator+(difference_type n) const; + constexpr move_iterator& operator+=(difference_type n); + constexpr move_iterator operator-(difference_type n) const; + constexpr move_iterator& operator-=(difference_type n); + constexpr unspecified operator[](difference_type n) const; private: Iterator current; // exposition only }; template <class Iterator1, class Iterator2> -bool +constexpr bool // constexpr in C++17 operator==(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> -bool +constexpr bool // constexpr in C++17 operator!=(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> -bool +constexpr bool // constexpr in C++17 operator<(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> -bool +constexpr bool // constexpr in C++17 operator<=(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> -bool +constexpr bool // constexpr in C++17 operator>(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> -bool +constexpr bool // constexpr in C++17 operator>=(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> -auto +constexpr auto // constexpr in C++17 operator-(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y) -> decltype(x.base() - y.base()); template <class Iterator> -move_iterator<Iterator> operator+(typename move_iterator<Iterator>::difference_type n, - const move_iterator<Iterator>& x); +constexpr move_iterator<Iterator> operator+( // constexpr in C++17 + typename move_iterator<Iterator>::difference_type n, + const move_iterator<Iterator>& x); -template <class Iterator> -move_iterator<Iterator> make_move_iterator(const Iterator& i); +template <class Iterator> // constexpr in C++17 +constexpr move_iterator<Iterator> make_move_iterator(const Iterator& i); template <class T, class charT = char, class traits = char_traits<charT>, class Distance = ptrdiff_t> @@ -511,8 +514,8 @@ struct __is_random_access_iterator : pub template <class _Tp> struct __is_exactly_input_iterator : public integral_constant<bool, - __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value && - !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value> {}; + __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value && + !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value> {}; template<class _Category, class _Tp, class _Distance = ptrdiff_t, class _Pointer = _Tp*, class _Reference = _Tp&> @@ -1055,37 +1058,40 @@ public: typedef typename iterator_traits<iterator_type>::reference reference; #endif - _LIBCPP_INLINE_VISIBILITY move_iterator() : __i() {} - _LIBCPP_INLINE_VISIBILITY explicit move_iterator(_Iter __x) : __i(__x) {} - template <class _Up> _LIBCPP_INLINE_VISIBILITY move_iterator(const move_iterator<_Up>& __u) - : __i(__u.base()) {} - _LIBCPP_INLINE_VISIBILITY _Iter base() const {return __i;} - _LIBCPP_INLINE_VISIBILITY reference operator*() const { - return static_cast<reference>(*__i); - } - _LIBCPP_INLINE_VISIBILITY pointer operator->() const { return __i;} - _LIBCPP_INLINE_VISIBILITY move_iterator& operator++() {++__i; return *this;} - _LIBCPP_INLINE_VISIBILITY move_iterator operator++(int) - {move_iterator __tmp(*this); ++__i; return __tmp;} - _LIBCPP_INLINE_VISIBILITY move_iterator& operator--() {--__i; return *this;} - _LIBCPP_INLINE_VISIBILITY move_iterator operator--(int) - {move_iterator __tmp(*this); --__i; return __tmp;} - _LIBCPP_INLINE_VISIBILITY move_iterator operator+ (difference_type __n) const - {return move_iterator(__i + __n);} - _LIBCPP_INLINE_VISIBILITY move_iterator& operator+=(difference_type __n) - {__i += __n; return *this;} - _LIBCPP_INLINE_VISIBILITY move_iterator operator- (difference_type __n) const - {return move_iterator(__i - __n);} - _LIBCPP_INLINE_VISIBILITY move_iterator& operator-=(difference_type __n) - {__i -= __n; return *this;} - _LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const - { - return static_cast<reference>(__i[__n]); - } + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator() : __i() {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + explicit move_iterator(_Iter __x) : __i(__x) {} + template <class _Up> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator(const move_iterator<_Up>& __u) : __i(__u.base()) {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 _Iter base() const {return __i;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + reference operator*() const { return static_cast<reference>(*__i); } + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + pointer operator->() const { return __i;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator& operator++() {++__i; return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator operator++(int) {move_iterator __tmp(*this); ++__i; return __tmp;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator& operator--() {--__i; return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator operator--(int) {move_iterator __tmp(*this); --__i; return __tmp;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator operator+ (difference_type __n) const {return move_iterator(__i + __n);} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator& operator+=(difference_type __n) {__i += __n; return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator operator- (difference_type __n) const {return move_iterator(__i - __n);} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator& operator-=(difference_type __n) {__i -= __n; return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + reference operator[](difference_type __n) const { return static_cast<reference>(__i[__n]); } }; template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { @@ -1093,7 +1099,7 @@ operator==(const move_iterator<_Iter1>& } template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator<(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { @@ -1101,7 +1107,7 @@ operator<(const move_iterator<_Iter1>& _ } template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { @@ -1109,7 +1115,7 @@ operator!=(const move_iterator<_Iter1>& } template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { @@ -1117,7 +1123,7 @@ operator>(const move_iterator<_Iter1>& _ } template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator>=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { @@ -1125,7 +1131,7 @@ operator>=(const move_iterator<_Iter1>& } template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator<=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { @@ -1134,7 +1140,7 @@ operator<=(const move_iterator<_Iter1>& #ifndef _LIBCPP_CXX03_LANG template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 auto operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) -> decltype(__x.base() - __y.base()) @@ -1152,7 +1158,7 @@ operator-(const move_iterator<_Iter1>& _ #endif template <class _Iter> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 move_iterator<_Iter> operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterator<_Iter>& __x) { @@ -1160,7 +1166,7 @@ operator+(typename move_iterator<_Iter>: } template <class _Iter> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 move_iterator<_Iter> make_move_iterator(_Iter __i) { @@ -1550,19 +1556,19 @@ operator+(typename __wrap_iter<_Iter>::d template <class _Iter> struct __libcpp_is_trivial_iterator - : public _LIBCPP_BOOL_CONSTANT(is_pointer<_Iter>::value) {}; - + : public _LIBCPP_BOOL_CONSTANT(is_pointer<_Iter>::value) {}; + template <class _Iter> struct __libcpp_is_trivial_iterator<move_iterator<_Iter> > - : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {}; + : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {}; template <class _Iter> struct __libcpp_is_trivial_iterator<reverse_iterator<_Iter> > - : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {}; + : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {}; template <class _Iter> struct __libcpp_is_trivial_iterator<__wrap_iter<_Iter> > - : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {}; + : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {}; template <class _Tp, size_t _Np> Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp Wed Nov 2 10:30:26 2016 @@ -14,10 +14,13 @@ // template <InputIterator Iter> // move_iterator<Iter> // make_move_iterator(const Iter& i); +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -43,4 +46,12 @@ int main() std::make_move_iterator(a+4); std::make_move_iterator(a); // test for LWG issue 2061 } + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + constexpr auto iter = std::make_move_iterator<const char *>(p); + static_assert(iter.base() == p); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.pass.cpp Wed Nov 2 10:30:26 2016 @@ -16,10 +16,13 @@ // auto // operator-(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y) // -> decltype(x.base() - y.base()); +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -36,4 +39,15 @@ int main() char s[] = "1234567890"; test(random_access_iterator<char*>(s+5), random_access_iterator<char*>(s), 5); test(s+5, s, 5); + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + typedef std::move_iterator<const char *> MI; + constexpr MI it1 = std::make_move_iterator(p); + constexpr MI it2 = std::make_move_iterator(p+1); + static_assert( it1 - it2 == -1, ""); + static_assert( it2 - it1 == 1, ""); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.pass.cpp Wed Nov 2 10:30:26 2016 @@ -14,10 +14,13 @@ // template <RandomAccessIterator Iter> // move_iterator<Iter> // operator+(Iter::difference_type n, const move_iterator<Iter>& x); +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -34,4 +37,17 @@ int main() char s[] = "1234567890"; test(random_access_iterator<char*>(s+5), 5, random_access_iterator<char*>(s+10)); test(s+5, 5, s+10); + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + typedef std::move_iterator<const char *> MI; + constexpr MI it1 = std::make_move_iterator(p); + constexpr MI it2 = std::make_move_iterator(p + 5); + constexpr MI it3 = it1 + 5; + static_assert(it1 != it2, ""); + static_assert(it1 != it3, ""); + static_assert(it2 == it3, ""); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+/difference_type.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.%2B/difference_type.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+/difference_type.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+/difference_type.pass.cpp Wed Nov 2 10:30:26 2016 @@ -13,10 +13,13 @@ // requires RandomAccessIterator<Iter> // move_iterator operator+(difference_type n) const; +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -33,4 +36,17 @@ int main() const char* s = "1234567890"; test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s+10)); test(s+5, 5, s+10); + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + typedef std::move_iterator<const char *> MI; + constexpr MI it1 = std::make_move_iterator(p); + constexpr MI it2 = std::make_move_iterator(p + 5); + constexpr MI it3 = it1 + 5; + static_assert(it1 != it2, ""); + static_assert(it1 != it3, ""); + static_assert(it2 == it3, ""); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+=/difference_type.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.%2B%3D/difference_type.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+=/difference_type.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+=/difference_type.pass.cpp Wed Nov 2 10:30:26 2016 @@ -13,10 +13,13 @@ // requires RandomAccessIterator<Iter> // move_iterator& operator+=(difference_type n); +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -34,4 +37,17 @@ int main() const char* s = "1234567890"; test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s+10)); test(s+5, 5, s+10); + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + typedef std::move_iterator<const char *> MI; + constexpr MI it1 = std::make_move_iterator(p); + constexpr MI it2 = std::make_move_iterator(p + 5); + constexpr MI it3 = std::make_move_iterator(p) += 5; + static_assert(it1 != it2, ""); + static_assert(it1 != it3, ""); + static_assert(it2 == it3, ""); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.pass.cpp Wed Nov 2 10:30:26 2016 @@ -13,10 +13,13 @@ // requires RandomAccessIterator<Iter> // move_iterator operator-(difference_type n) const; +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -33,4 +36,17 @@ int main() const char* s = "1234567890"; test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s)); test(s+5, 5, s); + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + typedef std::move_iterator<const char *> MI; + constexpr MI it1 = std::make_move_iterator(p); + constexpr MI it2 = std::make_move_iterator(p + 5); + constexpr MI it3 = it2 - 5; + static_assert(it1 != it2, ""); + static_assert(it1 == it3, ""); + static_assert(it2 != it3, ""); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-=/difference_type.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-%3D/difference_type.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-=/difference_type.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-=/difference_type.pass.cpp Wed Nov 2 10:30:26 2016 @@ -13,10 +13,13 @@ // requires RandomAccessIterator<Iter> // move_iterator& operator-=(difference_type n); +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -34,4 +37,13 @@ int main() const char* s = "1234567890"; test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s)); test(s+5, 5, s); + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + constexpr auto it1 = std::make_move_iterator(p); + constexpr auto it2 = std::make_move_iterator(p+5) -= 5; + static_assert(it1 == it2, ""); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.pass.cpp Wed Nov 2 10:30:26 2016 @@ -15,10 +15,13 @@ // requires HasEqualTo<Iter1, Iter2> // bool // operator==(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y); +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -43,4 +46,17 @@ int main() test(random_access_iterator<char*>(s), random_access_iterator<char*>(s+1), false); test(s, s, true); test(s, s+1, false); + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + typedef std::move_iterator<const char *> MI; + constexpr MI it1 = std::make_move_iterator(p); + constexpr MI it2 = std::make_move_iterator(p + 5); + constexpr MI it3 = std::make_move_iterator(p); + static_assert(!(it1 == it2), ""); + static_assert( (it1 == it3), ""); + static_assert(!(it2 == it3), ""); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.pass.cpp Wed Nov 2 10:30:26 2016 @@ -15,10 +15,13 @@ // requires HasLess<Iter2, Iter1> // bool // operator>(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y); +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -39,4 +42,17 @@ int main() test(s, s, false); test(s, s+1, false); test(s+1, s, true); + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + typedef std::move_iterator<const char *> MI; + constexpr MI it1 = std::make_move_iterator(p); + constexpr MI it2 = std::make_move_iterator(p + 5); + constexpr MI it3 = std::make_move_iterator(p); + static_assert(!(it1 > it2), ""); + static_assert(!(it1 > it3), ""); + static_assert( (it2 > it3), ""); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.pass.cpp Wed Nov 2 10:30:26 2016 @@ -15,10 +15,13 @@ // requires HasLess<Iter1, Iter2> // bool // operator>=(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y); +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -39,4 +42,17 @@ int main() test(s, s, true); test(s, s+1, false); test(s+1, s, true); + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + typedef std::move_iterator<const char *> MI; + constexpr MI it1 = std::make_move_iterator(p); + constexpr MI it2 = std::make_move_iterator(p + 5); + constexpr MI it3 = std::make_move_iterator(p); + static_assert(!(it1 >= it2), ""); + static_assert( (it1 >= it3), ""); + static_assert( (it2 >= it3), ""); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.pass.cpp Wed Nov 2 10:30:26 2016 @@ -15,10 +15,13 @@ // requires HasLess<Iter1, Iter2> // bool // operator<(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y); +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -39,4 +42,17 @@ int main() test(s, s, false); test(s, s+1, true); test(s+1, s, false); + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + typedef std::move_iterator<const char *> MI; + constexpr MI it1 = std::make_move_iterator(p); + constexpr MI it2 = std::make_move_iterator(p + 5); + constexpr MI it3 = std::make_move_iterator(p); + static_assert( (it1 < it2), ""); + static_assert(!(it1 < it3), ""); + static_assert(!(it2 < it3), ""); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.pass.cpp Wed Nov 2 10:30:26 2016 @@ -15,10 +15,13 @@ // requires HasLess<Iter2, Iter1> // bool // operator<=(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y); +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -39,4 +42,17 @@ int main() test(s, s, true); test(s, s+1, true); test(s+1, s, false); + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + typedef std::move_iterator<const char *> MI; + constexpr MI it1 = std::make_move_iterator(p); + constexpr MI it2 = std::make_move_iterator(p + 5); + constexpr MI it3 = std::make_move_iterator(p); + static_assert( (it1 <= it2), ""); + static_assert( (it1 <= it3), ""); + static_assert(!(it2 <= it3), ""); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.pass.cpp Wed Nov 2 10:30:26 2016 @@ -15,10 +15,13 @@ // requires HasEqualTo<Iter1, Iter2> // bool // operator!=(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y); +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -43,4 +46,17 @@ int main() test(random_access_iterator<char*>(s), random_access_iterator<char*>(s+1), true); test(s, s, false); test(s, s+1, true); + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + typedef std::move_iterator<const char *> MI; + constexpr MI it1 = std::make_move_iterator(p); + constexpr MI it2 = std::make_move_iterator(p + 5); + constexpr MI it3 = std::make_move_iterator(p); + static_assert( (it1 != it2), ""); + static_assert(!(it1 != it3), ""); + static_assert( (it2 != it3), ""); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.pass.cpp Wed Nov 2 10:30:26 2016 @@ -14,10 +14,13 @@ // template <class U> // requires HasConstructor<Iter, const U&> // move_iterator(const move_iterator<U> &u); +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It, class U> @@ -41,4 +44,13 @@ int main() test<bidirectional_iterator<Base*> >(bidirectional_iterator<Derived*>(&d)); test<random_access_iterator<const Base*> >(random_access_iterator<Derived*>(&d)); test<Base*>(&d); + +#if TEST_STD_VER > 14 + { + constexpr const Derived *p = nullptr; + constexpr std::move_iterator<const Derived *> it1 = std::make_move_iterator(p); + constexpr std::move_iterator<const Base *> it2(it1); + static_assert(it2.base() == p); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp Wed Nov 2 10:30:26 2016 @@ -12,9 +12,12 @@ // move_iterator // move_iterator(); +// +// constexpr in C++17 #include <iterator> +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -31,4 +34,10 @@ int main() test<bidirectional_iterator<char*> >(); test<random_access_iterator<char*> >(); test<char*>(); + +#if TEST_STD_VER > 14 + { + constexpr std::move_iterator<const char *> it; + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp Wed Nov 2 10:30:26 2016 @@ -12,10 +12,13 @@ // move_iterator // explicit move_iterator(Iter i); +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -34,4 +37,12 @@ int main() test(bidirectional_iterator<char*>(s)); test(random_access_iterator<char*>(s)); test(s); + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + constexpr std::move_iterator<const char *> it(p); + static_assert(it.base() == p); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.pass.cpp Wed Nov 2 10:30:26 2016 @@ -12,10 +12,13 @@ // move_iterator // move_iterator operator--(int); +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -34,4 +37,17 @@ int main() test(bidirectional_iterator<char*>(s+1), bidirectional_iterator<char*>(s)); test(random_access_iterator<char*>(s+1), random_access_iterator<char*>(s)); test(s+1, s); + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + typedef std::move_iterator<const char *> MI; + constexpr MI it1 = std::make_move_iterator(p); + constexpr MI it2 = std::make_move_iterator(p+1); + static_assert(it1 != it2, ""); + constexpr MI it3 = std::make_move_iterator(p+1) --; + static_assert(it1 != it3, ""); + static_assert(it2 == it3, ""); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.pass.cpp Wed Nov 2 10:30:26 2016 @@ -12,10 +12,13 @@ // move_iterator // move_iterator& operator--(); +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -34,4 +37,17 @@ int main() test(bidirectional_iterator<char*>(s+1), bidirectional_iterator<char*>(s)); test(random_access_iterator<char*>(s+1), random_access_iterator<char*>(s)); test(s+1, s); + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + typedef std::move_iterator<const char *> MI; + constexpr MI it1 = std::make_move_iterator(p); + constexpr MI it2 = std::make_move_iterator(p+1); + static_assert(it1 != it2, ""); + constexpr MI it3 = -- std::make_move_iterator(p+1); + static_assert(it1 == it3, ""); + static_assert(it2 != it3, ""); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp Wed Nov 2 10:30:26 2016 @@ -12,10 +12,13 @@ // move_iterator // move_iterator operator++(int); +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -36,4 +39,17 @@ int main() test(bidirectional_iterator<char*>(s), bidirectional_iterator<char*>(s+1)); test(random_access_iterator<char*>(s), random_access_iterator<char*>(s+1)); test(s, s+1); + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + typedef std::move_iterator<const char *> MI; + constexpr MI it1 = std::make_move_iterator(p); + constexpr MI it2 = std::make_move_iterator(p+1); + static_assert(it1 != it2, ""); + constexpr MI it3 = std::make_move_iterator(p) ++; + static_assert(it1 == it3, ""); + static_assert(it2 != it3, ""); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.pass.cpp Wed Nov 2 10:30:26 2016 @@ -12,10 +12,13 @@ // move_iterator // move_iterator& operator++(); +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -36,4 +39,17 @@ int main() test(bidirectional_iterator<char*>(s), bidirectional_iterator<char*>(s+1)); test(random_access_iterator<char*>(s), random_access_iterator<char*>(s+1)); test(s, s+1); + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + typedef std::move_iterator<const char *> MI; + constexpr MI it1 = std::make_move_iterator(p); + constexpr MI it2 = std::make_move_iterator(p+1); + static_assert(it1 != it2, ""); + constexpr MI it3 = ++ std::make_move_iterator(p); + static_assert(it1 != it3, ""); + static_assert(it2 == it3, ""); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp Wed Nov 2 10:30:26 2016 @@ -13,6 +13,8 @@ // requires RandomAccessIterator<Iter> // unspecified operator[](difference_type n) const; +// +// constexpr in C++17 #include <iterator> #include <cassert> @@ -20,6 +22,7 @@ #include <memory> #endif +#include "test_macros.h" #include "test_iterators.h" template <class It> @@ -55,4 +58,14 @@ int main() p[j].reset(i+j); test(p, 3, Ptr(i+3)); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + typedef std::move_iterator<const char *> MI; + constexpr MI it1 = std::make_move_iterator(p); + static_assert(it1[0] == '1', ""); + static_assert(it1[5] == '6', ""); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp Wed Nov 2 10:30:26 2016 @@ -12,10 +12,14 @@ // move_iterator // pointer operator->() const; +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" + template <class It> void test(It i) @@ -28,4 +32,15 @@ int main() { char s[] = "123"; test(s); + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + typedef std::move_iterator<const char *> MI; + constexpr MI it1 = std::make_move_iterator(p); + constexpr MI it2 = std::make_move_iterator(p+1); + static_assert(it1.operator->() == p, ""); + static_assert(it2.operator->() == p + 1, ""); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp Wed Nov 2 10:30:26 2016 @@ -12,6 +12,8 @@ // move_iterator // reference operator*() const; +// +// constexpr in C++17 #include <iterator> #include <cassert> @@ -19,6 +21,8 @@ #include <memory> #endif +#include "test_macros.h" + class A { int data_; @@ -58,4 +62,15 @@ int main() std::unique_ptr<int, do_nothing> p(&i); test(&p, std::unique_ptr<int, do_nothing>(&i)); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#if TEST_STD_VER > 14 + { + constexpr const char *p = "123456789"; + typedef std::move_iterator<const char *> MI; + constexpr MI it1 = std::make_move_iterator(p); + constexpr MI it2 = std::make_move_iterator(p+1); + static_assert(*it1 == p[0], ""); + static_assert(*it2 == p[1], ""); + } +#endif } Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op%3D/move_iterator.pass.cpp?rev=285818&r1=285817&r2=285818&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp Wed Nov 2 10:30:26 2016 @@ -15,10 +15,13 @@ // requires HasAssign<Iter, const U&> // move_iterator& // operator=(const move_iterator<U>& u); +// +// constexpr in C++17 #include <iterator> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" template <class It, class U> @@ -44,4 +47,14 @@ int main() test<bidirectional_iterator<Base*> >(bidirectional_iterator<Derived*>(&d)); test<random_access_iterator<const Base*> >(random_access_iterator<Derived*>(&d)); test<Base*>(&d); +#if TEST_STD_VER > 14 + { + using BaseIter = std::move_iterator<const Base *>; + using DerivedIter = std::move_iterator<const Derived *>; + constexpr const Derived *p = nullptr; + constexpr DerivedIter it1 = std::make_move_iterator(p); + constexpr BaseIter it2 = (BaseIter{nullptr} = it1); + static_assert(it2.base() == p, ""); + } +#endif } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits