STL_MSFT created this revision. STL_MSFT added reviewers: EricWF, mclow.lists.
[libcxx] [test] Fix MSVC warnings and errors. test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp Fix MSVC x64 truncation warnings. warning C4267: conversion from 'size_t' to 'int', possible loss of data test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp Fix MSVC uninitialized memory warning. warning C6001: Using uninitialized memory 'vl'. test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp Include <cassert> for the assert() macro. https://reviews.llvm.org/D43273 Files: test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp
Index: test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp =================================================================== --- test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp +++ test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp @@ -16,6 +16,7 @@ #include <tuple> #include <string> +#include <cassert> #include "test_macros.h" #if TEST_HAS_BUILTIN_IDENTIFIER(__reference_binds_to_temporary) Index: test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp =================================================================== --- test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp +++ test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp @@ -52,7 +52,7 @@ { // https://bugs.llvm.org/show_bug.cgi?id=31454 std::basic_string<veryLarge> s; - veryLarge vl; + veryLarge vl = {}; s.push_back(vl); s.push_back(vl); s.push_back(vl); Index: test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp =================================================================== --- test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp +++ test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp @@ -105,15 +105,15 @@ std::iota(v.begin(), v.end(), 0); std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, 30); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 30 + triangle(i) + (int) (i + 1)); + assert(v[i] == 30 + triangle(static_cast<int>(i)) + static_cast<int>(i + 1)); } { std::vector<int> v(10); std::iota(v.begin(), v.end(), 1); std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}, 40); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 40 + triangle(i + 1) + (int) (i + 1)); + assert(v[i] == 40 + triangle(static_cast<int>(i + 1)) + static_cast<int>(i + 1)); } { @@ -134,7 +134,7 @@ assert(res[0] == 2); for (size_t i = 1; i < res.size(); ++i) { - j *= i + 2; + j = static_cast<int>(j * (i + 2)); assert(res[i] == j); } } Index: test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp =================================================================== --- test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp +++ test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp @@ -96,15 +96,15 @@ std::iota(v.begin(), v.end(), 0); std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == triangle(i) + (int)(i + 1)); + assert(v[i] == triangle(static_cast<int>(i)) + static_cast<int>(i + 1)); } { std::vector<int> v(10); std::iota(v.begin(), v.end(), 1); std::transform_inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), add_one{}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == triangle(i + 1) + (int)(i + 1)); + assert(v[i] == triangle(static_cast<int>(i + 1)) + static_cast<int>(i + 1)); } { Index: test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp =================================================================== --- test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp +++ test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp @@ -105,15 +105,15 @@ std::iota(v.begin(), v.end(), 0); std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 30, std::plus<>(), add_one{}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 30 + triangle(i - 1) + (int) i); + assert(v[i] == 30 + triangle(static_cast<int>(i - 1)) + static_cast<int>(i)); } { std::vector<int> v(10); std::iota(v.begin(), v.end(), 1); std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 40, std::plus<>(), add_one{}); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 40 + triangle(i) + (int) i); + assert(v[i] == 40 + triangle(static_cast<int>(i)) + static_cast<int>(i)); } { @@ -134,7 +134,7 @@ assert(res[0] == 1); for (size_t i = 1; i < res.size(); ++i) { - j *= i + 1; + j = static_cast<int>(j * (i + 1)); assert(res[i] == j); } } Index: test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp =================================================================== --- test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp +++ test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp @@ -78,15 +78,15 @@ std::iota(v.begin(), v.end(), 0); std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), 40); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 40 + triangle(i)); + assert(v[i] == 40 + triangle(static_cast<int>(i))); } { std::vector<int> v(10); std::iota(v.begin(), v.end(), 1); std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>(), 30); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 30 + triangle(i + 1)); + assert(v[i] == 30 + triangle(static_cast<int>(i + 1))); } { @@ -107,7 +107,7 @@ assert(res[0] == 1); for (size_t i = 1; i < v.size(); ++i) { - j *= i + 1; + j = static_cast<int>(j * (i + 1)); assert(res[i] == j); } } Index: test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp =================================================================== --- test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp +++ test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp @@ -79,15 +79,15 @@ std::iota(v.begin(), v.end(), 0); std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>()); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == triangle(i)); + assert(v[i] == triangle(static_cast<int>(i))); } { std::vector<int> v(10); std::iota(v.begin(), v.end(), 1); std::inclusive_scan(v.begin(), v.end(), v.begin(), std::plus<>()); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == triangle(i + 1)); + assert(v[i] == triangle(static_cast<int>(i + 1))); } { Index: test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp =================================================================== --- test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp +++ test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp @@ -73,15 +73,15 @@ std::iota(v.begin(), v.end(), 0); std::inclusive_scan(v.begin(), v.end(), v.begin()); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == triangle(i)); + assert(v[i] == triangle(static_cast<int>(i))); } { std::vector<int> v(10); std::iota(v.begin(), v.end(), 1); std::inclusive_scan(v.begin(), v.end(), v.begin()); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == triangle(i + 1)); + assert(v[i] == triangle(static_cast<int>(i + 1))); } { Index: test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp =================================================================== --- test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp +++ test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp @@ -82,7 +82,7 @@ assert(res[0] == 1); for (size_t i = 1; i < v.size(); ++i) { - j *= i; + j = static_cast<int>(j * i); assert(res[i] == j); } } Index: test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp =================================================================== --- test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp +++ test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp @@ -73,15 +73,15 @@ std::iota(v.begin(), v.end(), 0); std::exclusive_scan(v.begin(), v.end(), v.begin(), 30); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 30 + triangle(i-1)); + assert(v[i] == 30 + triangle(static_cast<int>(i-1))); } { std::vector<int> v(10); std::iota(v.begin(), v.end(), 1); std::exclusive_scan(v.begin(), v.end(), v.begin(), 40); for (size_t i = 0; i < v.size(); ++i) - assert(v[i] == 40 + triangle(i)); + assert(v[i] == 40 + triangle(static_cast<int>(i))); } }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits