[libcxx-commits] [libcxx] 6057517 - [libcxx][test] Silence MSVC narrowing warning

Casey Carter via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jan 29 11:06:17 PST 2021


Author: Casey Carter
Date: 2021-01-29T11:05:52-08:00
New Revision: 605751790418ca4fb1df1e94dfbac34cfcc1b96f

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

LOG: [libcxx][test] Silence MSVC narrowing warning

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 59e5f7f52f01..8ad0fe32d8d9 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
@@ -53,8 +53,8 @@ void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result) {
     int count = 0;
     std::default_searcher<Iter2, count_equal> s{b2, e2, count_equal{&count}};
     assert(result == std::search(b1, e1, s));
-    int d1 = std::distance(b1, e1);
-    int d2 = std::distance(b2, e2);
+    auto d1 = std::distance(b1, e1);
+    auto 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