[libcxx-commits] [PATCH] D87459: [libcxx][test] ostream{, buf}_iterator::difference_type changes in C++20

Casey Carter via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 10 08:27:42 PDT 2020


CaseyCarter created this revision.
CaseyCarter added reviewers: ldionne, mclow.lists, EricWF.
Herald added subscribers: libcxx-commits, dexonsmith.
Herald added a project: libc++.
Herald added a reviewer: libc++.
CaseyCarter requested review of this revision.

Although libc++ doesn't yet implement this change, these tests should expect the difference type of `std::ostream_iterator` and `std::ostreambuf_iterator` specializations to be `std::ptrdiff_t` instead of `void` when testing C++ versions greater than 17 if the library under test is not libc++.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87459

Files:
  libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
  libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp


Index: libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp
===================================================================
--- libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp
+++ libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp
@@ -19,6 +19,7 @@
 //   typedef basic_ostream<charT, traits>   ostream_type;
 //   ...
 
+#include <cstddef>
 #include <iterator>
 #include <string>
 #include <type_traits>
@@ -34,7 +35,11 @@
 #else
     static_assert((std::is_same<I1::iterator_category, std::output_iterator_tag>::value), "");
     static_assert((std::is_same<I1::value_type, void>::value), "");
+#if TEST_STD_VER <= 17 || defined(_LIBCPP_VERSION)
     static_assert((std::is_same<I1::difference_type, void>::value), "");
+#else
+    static_assert((std::is_same<I1::difference_type, std::ptrdiff_t>::value), "");
+#endif
     static_assert((std::is_same<I1::pointer, void>::value), "");
     static_assert((std::is_same<I1::reference, void>::value), "");
 #endif
@@ -50,7 +55,11 @@
 #else
     static_assert((std::is_same<I2::iterator_category, std::output_iterator_tag>::value), "");
     static_assert((std::is_same<I2::value_type, void>::value), "");
+#if TEST_STD_VER <= 17 || defined(_LIBCPP_VERSION)
     static_assert((std::is_same<I2::difference_type, void>::value), "");
+#else
+    static_assert((std::is_same<I2::difference_type, std::ptrdiff_t>::value), "");
+#endif
     static_assert((std::is_same<I2::pointer, void>::value), "");
     static_assert((std::is_same<I2::reference, void>::value), "");
 #endif
Index: libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
===================================================================
--- libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
+++ libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp
@@ -19,6 +19,7 @@
 //     typedef basic_istream<charT,traits> istream_type;
 //     ...
 
+#include <cstddef>
 #include <iterator>
 #include <type_traits>
 
@@ -33,7 +34,11 @@
 #else
     static_assert((std::is_same<I1::iterator_category, std::output_iterator_tag>::value), "");
     static_assert((std::is_same<I1::value_type, void>::value), "");
+#if TEST_STD_VER <= 17 || defined(_LIBCPP_VERSION)
     static_assert((std::is_same<I1::difference_type, void>::value), "");
+#else
+    static_assert((std::is_same<I1::difference_type, std::ptrdiff_t>::value), "");
+#endif
     static_assert((std::is_same<I1::pointer, void>::value), "");
     static_assert((std::is_same<I1::reference, void>::value), "");
 #endif
@@ -47,7 +52,11 @@
 #else
     static_assert((std::is_same<I2::iterator_category, std::output_iterator_tag>::value), "");
     static_assert((std::is_same<I2::value_type, void>::value), "");
+#if TEST_STD_VER <= 17 || defined(_LIBCPP_VERSION)
     static_assert((std::is_same<I2::difference_type, void>::value), "");
+#else
+    static_assert((std::is_same<I2::difference_type, std::ptrdiff_t>::value), "");
+#endif
     static_assert((std::is_same<I2::pointer, void>::value), "");
     static_assert((std::is_same<I2::reference, void>::value), "");
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87459.290981.patch
Type: text/x-patch
Size: 3187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200910/3896e11d/attachment.bin>


More information about the libcxx-commits mailing list