[PATCH] D40324: [libcxx] [test] Resolve C1XX warning in new vector<bool>::size tests caused by assert(true)

Billy Robert O'Neal III via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 21 14:53:02 PST 2017


BillyONeal created this revision.

In a17cd7c641c34b6c4bd4845a4d4fb590cb6c238c Marshall added assert(true) to the vector<bool>::size tests, which break on C1XX:
D:\Contest\gl0qojfu.5pe\src\qa\vc\libs\libcxx\upstream\test\std\containers\sequences\vector.bool\size.pass.cpp(62): error C2220: warning treated as error - no 'object' file generated
d:\contest\gl0qojfu.5pe\src\qa\vc\libs\libcxx\upstream\test\std\containers\sequences\vector.bool\size.pass.cpp(33) : warning C6326: Potential comparison of a constant with another constant.
d:\contest\gl0qojfu.5pe\src\qa\vc\libs\libcxx\upstream\test\std\containers\sequences\vector.bool\size.pass.cpp(52) : warning C6326: Potential comparison of a constant with another constant.

The corresponding test for vector::size asserts assert(c.size() == 3);, so I changed it to do that here.


https://reviews.llvm.org/D40324

Files:
  test/std/containers/sequences/vector.bool/size.pass.cpp


Index: test/std/containers/sequences/vector.bool/size.pass.cpp
===================================================================
--- test/std/containers/sequences/vector.bool/size.pass.cpp
+++ test/std/containers/sequences/vector.bool/size.pass.cpp
@@ -31,7 +31,7 @@
     c.push_back(true);
     assert(c.size() == 2);
     c.push_back(C::value_type(3));
-    assert(true);
+    assert(c.size() == 3);
     c.erase(c.begin());
     assert(c.size() == 2);
     c.erase(c.begin());
@@ -50,7 +50,7 @@
     c.push_back(true);
     assert(c.size() == 2);
     c.push_back(C::value_type(3));
-    assert(true);
+    assert(c.size() == 3);
     c.erase(c.begin());
     assert(c.size() == 2);
     c.erase(c.begin());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40324.123855.patch
Type: text/x-patch
Size: 713 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171121/60894692/attachment.bin>


More information about the cfe-commits mailing list