diff options
| author | Stephan T. Lavavej <stl@exchange.microsoft.com> | 2016-12-06 01:13:51 +0000 |
|---|---|---|
| committer | Stephan T. Lavavej <stl@exchange.microsoft.com> | 2016-12-06 01:13:51 +0000 |
| commit | e9c728899f2b0f59b17c11ac146f16483a521c59 (patch) | |
| tree | fafb7d5a72d89acc86a9fe85093d1704d74f02fb /libcxx/test/std/containers/sequences/deque | |
| parent | 6859c20ac99a04403f605b7fd0b8083cf945d2f2 (diff) | |
| download | bcm5719-llvm-e9c728899f2b0f59b17c11ac146f16483a521c59.tar.gz bcm5719-llvm-e9c728899f2b0f59b17c11ac146f16483a521c59.zip | |
[libcxx] [test] D27025: Fix MSVC warning C4389 "signed/unsigned mismatch", part 12/12.
Various changes:
test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp
This is comparing value_type to unsigned. value_type is sometimes int and sometimes struct S (implicitly constructible from int).
static_cast<value_type>(unsigned) silences the warning and doesn't do anything bad (as the values in question are small).
test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp
This is comparing an int remote-element to size_t. The values in question are small and non-negative,
so either type is fine. I think that converting int to size_t is marginally better here than the reverse.
test/std/containers/sequences/deque/deque.cons/size.pass.cpp
DefaultOnly::count is int (and non-negative). When comparing to unsigned, use static_cast<unsigned>.
test/std/strings/basic.string/string.access/index.pass.cpp
We're comparing char to '0' through '9', but formed with the type size_t. Add static_cast<char>.
test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp
Include <cstddef> for pedantic correctness (this test was already mentioning std::size_t).
"v[i] == (i & 1)" was comparing bool to size_t. Saying "v[i] == ((i & 1) != 0)" smashes the RHS to bool.
llvm-svn: 288749
Diffstat (limited to 'libcxx/test/std/containers/sequences/deque')
| -rw-r--r-- | libcxx/test/std/containers/sequences/deque/deque.cons/size.pass.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/size.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/size.pass.cpp index 239c71d993d..c983a604ed1 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.cons/size.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.cons/size.pass.cpp @@ -30,7 +30,7 @@ test2(unsigned n) assert(DefaultOnly::count == 0); { C d(n, Allocator()); - assert(DefaultOnly::count == n); + assert(static_cast<unsigned>(DefaultOnly::count) == n); assert(d.size() == n); assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size()); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -51,7 +51,7 @@ test1(unsigned n) assert(DefaultOnly::count == 0); { C d(n); - assert(DefaultOnly::count == n); + assert(static_cast<unsigned>(DefaultOnly::count) == n); assert(d.size() == n); assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size()); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |

