[libcxx-commits] [PATCH] D114563: [libc++] Fix ssize test that made an assumption about ptrdiff_t being 'long'

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Nov 24 14:03:44 PST 2021


ldionne updated this revision to Diff 389611.
ldionne retitled this revision from "[libc++] Fix ssize test that made an assumption about ptrdiff_t" to "[libc++] Fix ssize test that made an assumption about ptrdiff_t being 'long'".
ldionne edited the summary of this revision.
ldionne added a comment.

Amend commit message.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114563

Files:
  libcxx/test/std/iterators/iterator.container/ssize.pass.cpp


Index: libcxx/test/std/iterators/iterator.container/ssize.pass.cpp
===================================================================
--- libcxx/test/std/iterators/iterator.container/ssize.pass.cpp
+++ libcxx/test/std/iterators/iterator.container/ssize.pass.cpp
@@ -78,14 +78,15 @@
     std::list<int>   l; l.push_back(2);
     std::array<int, 1> a; a[0] = 3;
     std::initializer_list<int> il = { 4 };
+    using SSize = std::common_type_t<std::ptrdiff_t, std::make_signed_t<std::size_t>>;
     test_container ( v );
-    ASSERT_SAME_TYPE(ptrdiff_t, decltype(std::ssize(v)));
+    ASSERT_SAME_TYPE(SSize, decltype(std::ssize(v)));
     test_container ( l );
-    ASSERT_SAME_TYPE(ptrdiff_t, decltype(std::ssize(l)));
+    ASSERT_SAME_TYPE(SSize, decltype(std::ssize(l)));
     test_container ( a );
-    ASSERT_SAME_TYPE(ptrdiff_t, decltype(std::ssize(a)));
+    ASSERT_SAME_TYPE(SSize, decltype(std::ssize(a)));
     test_container ( il );
-    ASSERT_SAME_TYPE(ptrdiff_t, decltype(std::ssize(il)));
+    ASSERT_SAME_TYPE(SSize, decltype(std::ssize(il)));
 
     test_const_container ( v );
     test_const_container ( l );
@@ -94,7 +95,7 @@
 
     std::string_view sv{"ABC"};
     test_container ( sv );
-    ASSERT_SAME_TYPE(ptrdiff_t, decltype(std::ssize(sv)));
+    ASSERT_SAME_TYPE(SSize, decltype(std::ssize(sv)));
     test_const_container ( sv );
 
     static constexpr int arrA [] { 1, 2, 3 };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114563.389611.patch
Type: text/x-patch
Size: 1408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211124/e71cada3/attachment.bin>


More information about the libcxx-commits mailing list