From 6859c20ac99a04403f605b7fd0b8083cf945d2f2 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 6 Dec 2016 01:13:40 +0000 Subject: [libcxx] [test] D27024: Fix MSVC warning C4389 "signed/unsigned mismatch", part 11/12. Change "unsigned n = 0;" to "int n = 0;". It's being compared to int elements and ptrdiff_t distances. test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp This one's a little special, but not really. "*i == n" is comparing MoveOnly to n. MoveOnly is implicitly constructible from int, so int is the correct type to use here. llvm-svn: 288748 --- .../containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp | 6 +++--- .../sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp | 6 +++--- .../containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp | 4 ++-- .../sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp | 4 ++-- .../containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp | 6 +++--- .../sequences/forwardlist/forwardlist.cons/range.pass.cpp | 4 ++-- .../sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) (limited to 'libcxx/test/std') diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp index 6a70d72042f..65ab7abe23b 100644 --- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp +++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp @@ -28,7 +28,7 @@ int main() const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; C c0(std::begin(t), std::end(t), A(10)); C c = c0; - unsigned n = 0; + int n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); assert(n == std::end(t) - std::begin(t)); @@ -43,7 +43,7 @@ int main() const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; C c0(std::begin(t), std::end(t), A(10)); C c = c0; - unsigned n = 0; + int n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); assert(n == std::end(t) - std::begin(t)); @@ -57,7 +57,7 @@ int main() const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; C c0(std::begin(t), std::end(t), A()); C c = c0; - unsigned n = 0; + int n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); assert(n == std::end(t) - std::begin(t)); diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp index e4b73bb54e9..744bba419f3 100644 --- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp @@ -27,7 +27,7 @@ int main() const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; C c0(std::begin(t), std::end(t), A(10)); C c(c0, A(9)); - unsigned n = 0; + int n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); assert(n == std::end(t) - std::begin(t)); @@ -41,7 +41,7 @@ int main() const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; C c0(std::begin(t), std::end(t), A(10)); C c(c0, A(9)); - unsigned n = 0; + int n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); assert(n == std::end(t) - std::begin(t)); @@ -56,7 +56,7 @@ int main() const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; C c0(std::begin(t), std::end(t), A()); C c(c0, A()); - unsigned n = 0; + int n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); assert(n == std::end(t) - std::begin(t)); diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp index c783f60ff4c..ac73d142a67 100644 --- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp +++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp @@ -23,7 +23,7 @@ int main() typedef int T; typedef std::forward_list C; C c = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; - unsigned n = 0; + int n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); assert(n == 10); @@ -33,7 +33,7 @@ int main() typedef int T; typedef std::forward_list> C; C c = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; - unsigned n = 0; + int n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); assert(n == 10); diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp index ba9984f969b..844be20015d 100644 --- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp @@ -25,7 +25,7 @@ int main() typedef test_allocator A; typedef std::forward_list C; C c({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, A(14)); - unsigned n = 0; + int n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); assert(n == 10); @@ -37,7 +37,7 @@ int main() typedef min_allocator A; typedef std::forward_list C; C c({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, A()); - unsigned n = 0; + int n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); assert(n == 10); diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp index a3e204ec28d..a5948b9ef79 100644 --- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp +++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp @@ -30,7 +30,7 @@ int main() typedef std::move_iterator I; C c0(I(std::begin(t)), I(std::end(t)), A(10)); C c = std::move(c0); - unsigned n = 0; + int n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); assert(n == std::end(t) - std::begin(t)); @@ -45,7 +45,7 @@ int main() typedef std::move_iterator I; C c0(I(std::begin(t)), I(std::end(t)), A(10)); C c = std::move(c0); - unsigned n = 0; + int n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); assert(n == std::end(t) - std::begin(t)); @@ -61,7 +61,7 @@ int main() typedef std::move_iterator I; C c0(I(std::begin(t)), I(std::end(t)), A()); C c = std::move(c0); - unsigned n = 0; + int n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); assert(n == std::end(t) - std::begin(t)); diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp index 3c0f2b8403c..5a7137463ca 100644 --- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp +++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp @@ -27,7 +27,7 @@ int main() typedef input_iterator I; const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; C c(I(std::begin(t)), I(std::end(t))); - unsigned n = 0; + int n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); assert(n == std::end(t) - std::begin(t)); @@ -39,7 +39,7 @@ int main() typedef input_iterator I; const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; C c(I(std::begin(t)), I(std::end(t))); - unsigned n = 0; + int n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); assert(n == std::end(t) - std::begin(t)); diff --git a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp index 96a29d24e89..03d1c4530c5 100644 --- a/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp +++ b/libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp @@ -30,7 +30,7 @@ int main() typedef input_iterator I; const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; C c(I(std::begin(t)), I(std::end(t)), A(13)); - unsigned n = 0; + int n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); assert(n == std::end(t) - std::begin(t)); @@ -44,7 +44,7 @@ int main() typedef input_iterator I; const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; C c(I(std::begin(t)), I(std::end(t)), A()); - unsigned n = 0; + int n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); assert(n == std::end(t) - std::begin(t)); -- cgit v1.2.3