diff options
author | Stephan T. Lavavej <stl@exchange.microsoft.com> | 2016-12-06 01:13:29 +0000 |
---|---|---|
committer | Stephan T. Lavavej <stl@exchange.microsoft.com> | 2016-12-06 01:13:29 +0000 |
commit | e17a155c618765c423cbb66ab010ee616aeb72b3 (patch) | |
tree | 0a8675cbd4409a4a85d71e1fb4007a31f5be0194 /libcxx/test/std/algorithms | |
parent | 68a694b800a9bb5f5cbbc5d8c956a87273356d20 (diff) | |
download | bcm5719-llvm-e17a155c618765c423cbb66ab010ee616aeb72b3.tar.gz bcm5719-llvm-e17a155c618765c423cbb66ab010ee616aeb72b3.zip |
[libcxx] [test] D27023: Fix MSVC warning C4389 "signed/unsigned mismatch", part 10/12.
Add static_cast<int>. In these cases, the values are guaranteed to be small-ish,
and they're being compared to int elements.
test/std/containers/sequences/deque/deque.capacity/access.pass.cpp
Use int instead of unsigned to iterate from 0 to 10.
llvm-svn: 288747
Diffstat (limited to 'libcxx/test/std/algorithms')
5 files changed, 7 insertions, 7 deletions
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp index 43234be5d3b..9a954d934c4 100644 --- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp +++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp @@ -53,7 +53,7 @@ test1() OutIter r = std::move(InIter(ia), InIter(ia+N), OutIter(ib)); assert(base(r) == ib+N); for (unsigned i = 0; i < N; ++i) - assert(*ib[i] == i); + assert(*ib[i] == static_cast<int>(i)); } #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp index 02b6b16eca0..c5f9d3ac7b6 100644 --- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp +++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp @@ -53,7 +53,7 @@ test1() OutIter r = std::move_backward(InIter(ia), InIter(ia+N), OutIter(ib+N)); assert(base(r) == ib); for (unsigned i = 0; i < N; ++i) - assert(*ib[i] == i); + assert(*ib[i] == static_cast<int>(i)); } #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/test.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/test.pass.cpp index bf80c2c6edd..d6fdd18968d 100644 --- a/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/test.pass.cpp +++ b/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/test.pass.cpp @@ -35,5 +35,5 @@ int main() for_each_test(0)); assert(f.count == s); for (unsigned i = 0; i < s; ++i) - assert(ia[i] == i+1); + assert(ia[i] == static_cast<int>(i+1)); } diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp index de96c419c4e..2a20cac0b79 100644 --- a/libcxx/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp @@ -40,7 +40,7 @@ test() InIter2(ib), InIter2(ib+N), OutIter(ic)); assert(base(r) == ic+2*N); assert(ic[0] == 0); - assert(ic[2*N-1] == 2*N-1); + assert(ic[2*N-1] == static_cast<int>(2*N-1)); assert(std::is_sorted(ic, ic+2*N)); delete [] ic; delete [] ib; @@ -62,7 +62,7 @@ test() InIter2(ib), InIter2(ib+N), OutIter(ic)); assert(base(r) == ic+2*N); assert(ic[0] == 0); - assert(ic[2*N-1] == 2*N-1); + assert(ic[2*N-1] == static_cast<int>(2*N-1)); assert(std::is_sorted(ic, ic+2*N)); delete [] ic; delete [] ib; diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp index bd38d7de689..152c552381b 100644 --- a/libcxx/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp @@ -46,7 +46,7 @@ test() OutIter r = std::merge(InIter1(ia), InIter1(ia+N), InIter2(ib), InIter2(ib+N), OutIter(ic), pred); assert(base(r) == ic+2*N); - assert(ic[0] == 2*N-1); + assert(ic[0] == static_cast<int>(2*N-1)); assert(ic[2*N-1] == 0); assert(std::is_sorted(ic, ic+2*N, std::greater<int>())); assert(pred.count() <= (N + N - 1)); @@ -70,7 +70,7 @@ test() OutIter r = std::merge(InIter1(ia), InIter1(ia+N), InIter2(ib), InIter2(ib+N), OutIter(ic), pred); assert(base(r) == ic+2*N); - assert(ic[0] == 2*N-1); + assert(ic[0] == static_cast<int>(2*N-1)); assert(ic[2*N-1] == 0); assert(std::is_sorted(ic, ic+2*N, std::greater<int>())); assert(pred.count() <= (N + N - 1)); |