[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
Wed May 6 16:30:31 PDT 2020


CaseyCarter updated this revision to Diff 262494.
CaseyCarter added a comment.

clang-format new/changed sections of code per policy.


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.262494.patch
Type: text/x-patch
Size: 1774 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200506/5fd01991/attachment.bin>


More information about the libcxx-commits mailing list