summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp11
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.pass.cpp14
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+/difference_type.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+=/difference_type.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-=/difference_type.pass.cpp12
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.pass.cpp12
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp9
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp11
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp13
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp15
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp15
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp13
24 files changed, 349 insertions, 0 deletions
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp
index 06834981e..d2ad79af6 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.pass.cpp
index d52175c92..758ef0f21 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.pass.cpp
index e67ebfca3..54b79b511 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+/difference_type.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+/difference_type.pass.cpp
index e9a19f493..e74be5e24 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+/difference_type.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+/difference_type.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+=/difference_type.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+=/difference_type.pass.cpp
index 5de1bccf8..6b4396c83 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+=/difference_type.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+=/difference_type.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.pass.cpp
index 852f76a4a..460636df7 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-=/difference_type.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-=/difference_type.pass.cpp
index f86307369..1b2ce8f0d 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-=/difference_type.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-=/difference_type.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.pass.cpp
index fb4f0fa1d..a365f08f3 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.pass.cpp
index 0edd2857c..ddd59a617 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.pass.cpp
index cb9cdb9ae..e78082e34 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.pass.cpp
index e7979ddd7..37034d516 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.pass.cpp
index 97a7bfdee..5074ee33a 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.pass.cpp
index 9e4b9e372..8e6c827fd 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.pass.cpp
index 8c73a7d5c..36d365194 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp
index 782cb6020..ba1406ada 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp
index 4a4a06018..09a534b66 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.pass.cpp
index 26fab5be7..f5f921a77 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.pass.cpp
index 700b3b637..c434b3082 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp
index e7c13b579..4ff511c13 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.pass.cpp
index f27c73727..e5d570429 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp
index 8d507b822..928da0061 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp
index b0c00e3fb..ef87014cd 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp
index 6de708baa..5665cb86c 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp
@@ -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
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp
index 449f7e809..30a95c367 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp
@@ -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
}