[libcxx-commits] [libcxx] c0a2d3b - [libc++] Fix a test failure in 7b00e9fae3 (D93815).

Arthur O'Dwyer via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 28 15:47:49 PST 2020


Author: Arthur O'Dwyer
Date: 2020-12-28T18:46:07-05:00
New Revision: c0a2d3b90b3b024247cb38f73219ed595e974431

URL: https://github.com/llvm/llvm-project/commit/c0a2d3b90b3b024247cb38f73219ed595e974431
DIFF: https://github.com/llvm/llvm-project/commit/c0a2d3b90b3b024247cb38f73219ed595e974431.diff

LOG: [libc++] Fix a test failure in 7b00e9fae3 (D93815).

"LLVM Buildbot on libcxx-libcxxabi-libunwind-armv7-linux" is not happy
with comparing `unsigned` and `int` [-Werror,-Wsign-compare].

Added: 
    

Modified: 
    libcxx/test/std/utilities/function.objects/func.search/func.search.default/default.pred.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/utilities/function.objects/func.search/func.search.default/default.pred.pass.cpp b/libcxx/test/std/utilities/function.objects/func.search/func.search.default/default.pred.pass.cpp
index bc9ba2f860b4..59e5f7f52f01 100644
--- a/libcxx/test/std/utilities/function.objects/func.search/func.search.default/default.pred.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.search/func.search.default/default.pred.pass.cpp
@@ -40,7 +40,7 @@
 
 struct count_equal
 {
-    unsigned *count;
+    int *count;
 
     template <class T>
     TEST_CONSTEXPR_CXX14 bool operator()(const T& x, const T& y) const
@@ -50,11 +50,11 @@ struct count_equal
 template <typename Iter1, typename Iter2>
 TEST_CONSTEXPR_CXX20
 void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result) {
-    unsigned count = 0;
+    int count = 0;
     std::default_searcher<Iter2, count_equal> s{b2, e2, count_equal{&count}};
     assert(result == std::search(b1, e1, s));
-    auto d1 = std::distance(b1, e1);
-    auto d2 = std::distance(b2, e2);
+    int d1 = std::distance(b1, e1);
+    int d2 = std::distance(b2, e2);
     assert((count >= 1) || (d2 == 0) || (d1 < d2));
     assert((d1 < d2) || count <= d1 * (d1 - d2 + 1));
 }


        


More information about the libcxx-commits mailing list