[libcxx] r346910 - [libcxx] [test] Fix MSVC warning C4800.

Stephan T. Lavavej stl at exchange.microsoft.com
Wed Nov 14 15:23:46 PST 2018


Author: stl_msft
Date: Wed Nov 14 15:23:46 2018
New Revision: 346910

URL: http://llvm.org/viewvc/llvm-project?rev=346910&view=rev
Log:
[libcxx] [test] Fix MSVC warning C4800.

This was implicitly converting [1, 3] to bool, which triggers
an MSVC warning. The test should just pass `true`, which is
simpler, has the same behavior, and avoids the warning. (This
is a library test, not a compiler test, and the conversion happens
before calling `push_back`, so passing [1, 3] isn't interesting
in any way. This resembles a previous change to stop passing
`1 == 1` in the `vector<bool>` tests.)

Modified:
    libcxx/trunk/test/std/containers/sequences/vector.bool/move.pass.cpp

Modified: libcxx/trunk/test/std/containers/sequences/vector.bool/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector.bool/move.pass.cpp?rev=346910&r1=346909&r2=346910&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/vector.bool/move.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/vector.bool/move.pass.cpp Wed Nov 14 15:23:46 2018
@@ -26,8 +26,8 @@ int main()
         std::vector<bool, test_allocator<bool> > lo(test_allocator<bool>(5));
         for (int i = 1; i <= 3; ++i)
         {
-            l.push_back(i);
-            lo.push_back(i);
+            l.push_back(true);
+            lo.push_back(true);
         }
         std::vector<bool, test_allocator<bool> > l2 = std::move(l);
         assert(l2 == lo);
@@ -39,8 +39,8 @@ int main()
         std::vector<bool, other_allocator<bool> > lo(other_allocator<bool>(5));
         for (int i = 1; i <= 3; ++i)
         {
-            l.push_back(i);
-            lo.push_back(i);
+            l.push_back(true);
+            lo.push_back(true);
         }
         std::vector<bool, other_allocator<bool> > l2 = std::move(l);
         assert(l2 == lo);
@@ -52,8 +52,8 @@ int main()
         std::vector<bool, min_allocator<bool> > lo(min_allocator<bool>{});
         for (int i = 1; i <= 3; ++i)
         {
-            l.push_back(i);
-            lo.push_back(i);
+            l.push_back(true);
+            lo.push_back(true);
         }
         std::vector<bool, min_allocator<bool> > l2 = std::move(l);
         assert(l2 == lo);




More information about the libcxx-commits mailing list