From 6367b42ac5bbacf466642c6258fb6d643424dbda Mon Sep 17 00:00:00 2001 From: Casey Carter Date: Mon, 13 Feb 2017 11:25:09 -0800 Subject: [PATCH] Silence warning in algorithm_tests with VS2017 (#453) Now that the STL respects /W4, this test that uses std::copy_n to copy a span of ints to a span of chars triggers "warning C4244: '=': conversion from 'int' to 'char', possible loss of data". Switch the source & destination spans to short and int to maintain the test's cross-type nature but without narrowing. --- tests/algorithm_tests.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/algorithm_tests.cpp b/tests/algorithm_tests.cpp index 2ee853a..3cf46d2 100644 --- a/tests/algorithm_tests.cpp +++ b/tests/algorithm_tests.cpp @@ -100,11 +100,11 @@ SUITE(copy_tests) { // dynamic source and destination span { - std::array src{1, 2, 3, 4, 5}; - std::array dst{}; + std::array src{1, 2, 3, 4, 5}; + std::array dst{}; - span src_span(src); - span dst_span(dst); + span src_span(src); + span dst_span(dst); copy(src_span, dst_span); copy(src_span, dst_span.subspan(src_span.size())); @@ -117,11 +117,11 @@ SUITE(copy_tests) // static source and dynamic destination span { - std::array src{1, 2, 3, 4, 5}; - std::array dst{}; + std::array src{1, 2, 3, 4, 5}; + std::array dst{}; - span src_span(src); - span dst_span(dst); + span src_span(src); + span dst_span(dst); copy(src_span, dst_span); copy(src_span, dst_span.subspan(src_span.size())); @@ -134,11 +134,11 @@ SUITE(copy_tests) // dynamic source and static destination span { - std::array src{1, 2, 3, 4, 5}; - std::array dst{}; + std::array src{1, 2, 3, 4, 5}; + std::array dst{}; - span src_span(src); - span dst_span(dst); + span src_span(src); + span dst_span(dst); copy(src_span, dst_span); copy(src_span, dst_span.subspan(src_span.size())); @@ -151,11 +151,11 @@ SUITE(copy_tests) // static source and destination span { - std::array src{1, 2, 3, 4, 5}; - std::array dst{}; + std::array src{1, 2, 3, 4, 5}; + std::array dst{}; - span src_span(src); - span dst_span(dst); + span src_span(src); + span dst_span(dst); copy(src_span, dst_span); copy(src_span, dst_span.subspan(src_span.size())); @@ -206,4 +206,4 @@ SUITE(copy_tests) } } -int main(int, const char* []) { return UnitTest::RunAllTests(); } +int main() { return UnitTest::RunAllTests(); }