[libcxx-commits] [PATCH] D79343: [libc++][test] Adjust move_iterator tests to allow C++20

Casey Carter via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 7 10:14:42 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG8615ce246d1c: [libc++][test] Adjust move_iterator tests to allow C++20 (authored by CaseyCarter).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79343/new/

https://reviews.llvm.org/D79343

Files:
  libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp
  libcxx/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp


Index: libcxx/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp
===================================================================
--- libcxx/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp
+++ libcxx/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp
@@ -35,6 +35,8 @@
   typedef std::ptrdiff_t difference_type;
   typedef ValueType* pointer;
   typedef Reference reference;
+
+  Reference operator*() const;
 };
 
 template <class It>
Index: libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp
===================================================================
--- libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp
+++ libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp
@@ -16,10 +16,20 @@
 
 #include <iterator>
 #include <cassert>
+#include <utility>
 
 #include "test_macros.h"
 #include "test_iterators.h"
 
+#if TEST_STD_VER > 17
+template <class It>
+void test_single_pass(It i, It x) {
+  std::move_iterator<It> r(std::move(i));
+  r++;
+  assert(std::move(r).base() == x);
+}
+#endif
+
 template <class It>
 void
 test(It i, It x)
@@ -33,7 +43,11 @@
 int main(int, char**)
 {
     char s[] = "123";
+#if TEST_STD_VER > 17
+    test_single_pass(input_iterator<char*>(s), input_iterator<char*>(s + 1));
+#else
     test(input_iterator<char*>(s), input_iterator<char*>(s+1));
+#endif
     test(forward_iterator<char*>(s), forward_iterator<char*>(s+1));
     test(bidirectional_iterator<char*>(s), bidirectional_iterator<char*>(s+1));
     test(random_access_iterator<char*>(s), random_access_iterator<char*>(s+1));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79343.262686.patch
Type: text/x-patch
Size: 1774 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200507/3e5fa698/attachment-0001.bin>


More information about the libcxx-commits mailing list