diff options
14 files changed, 28 insertions, 24 deletions
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp index 41a721d50f1..0f356e26d23 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp @@ -43,7 +43,7 @@ int main() { testbuf<char> sb(" "); std::istream is(&sb); - char c = is.get(); + char c = static_cast<char>(is.get()); assert(!is.eof()); assert(!is.fail()); assert(c == ' '); @@ -52,22 +52,22 @@ int main() { testbuf<char> sb(" abc"); std::istream is(&sb); - char c = is.get(); + char c = static_cast<char>(is.get()); assert(!is.eof()); assert(!is.fail()); assert(c == ' '); assert(is.gcount() == 1); - c = is.get(); + c = static_cast<char>(is.get()); assert(!is.eof()); assert(!is.fail()); assert(c == 'a'); assert(is.gcount() == 1); - c = is.get(); + c = static_cast<char>(is.get()); assert(!is.eof()); assert(!is.fail()); assert(c == 'b'); assert(is.gcount() == 1); - c = is.get(); + c = static_cast<char>(is.get()); assert(!is.eof()); assert(!is.fail()); assert(c == 'c'); diff --git a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp index 47e257a1868..e68fb774335 100644 --- a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp @@ -51,7 +51,7 @@ void test_hex(const char *expected) std::string str = ss.str(); for (size_t i = 0; i < str.size(); ++i ) - str[i] = std::toupper(str[i]); + str[i] = static_cast<char>(std::toupper(str[i])); assert(str == expected); } diff --git a/libcxx/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp b/libcxx/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp index 932ef25b784..0baefb5ee76 100644 --- a/libcxx/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp +++ b/libcxx/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp @@ -21,6 +21,10 @@ #pragma clang diagnostic ignored "-Wliteral-conversion" #endif +#ifdef _MSC_VER +#pragma warning(disable: 4244) // conversion from 'X' to 'Y', possible loss of data +#endif + int main() { { diff --git a/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp b/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp index a2ccca333cc..033ecdc31af 100644 --- a/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp @@ -50,7 +50,7 @@ int main() test<__int128_t>(0); test<__uint128_t>(0); #endif - test<float>(1./zero); + test<float>(1.f/zero); test<double>(1./zero); test<long double>(1./zero); } diff --git a/libcxx/test/std/numerics/complex.number/cmplx.over/arg.pass.cpp b/libcxx/test/std/numerics/complex.number/cmplx.over/arg.pass.cpp index 978c6255ac3..c649157a8c3 100644 --- a/libcxx/test/std/numerics/complex.number/cmplx.over/arg.pass.cpp +++ b/libcxx/test/std/numerics/complex.number/cmplx.over/arg.pass.cpp @@ -24,7 +24,7 @@ void test(T x, typename std::enable_if<std::is_integral<T>::value>::type* = 0) { static_assert((std::is_same<decltype(std::arg(x)), double>::value), ""); - assert(std::arg(x) == arg(std::complex<double>(x, 0))); + assert(std::arg(x) == arg(std::complex<double>(static_cast<double>(x), 0))); } template <class T> diff --git a/libcxx/test/std/numerics/complex.number/cmplx.over/norm.pass.cpp b/libcxx/test/std/numerics/complex.number/cmplx.over/norm.pass.cpp index badd5c0cc85..e847a9413e3 100644 --- a/libcxx/test/std/numerics/complex.number/cmplx.over/norm.pass.cpp +++ b/libcxx/test/std/numerics/complex.number/cmplx.over/norm.pass.cpp @@ -24,7 +24,7 @@ void test(T x, typename std::enable_if<std::is_integral<T>::value>::type* = 0) { static_assert((std::is_same<decltype(std::norm(x)), double>::value), ""); - assert(std::norm(x) == norm(std::complex<double>(x, 0))); + assert(std::norm(x) == norm(std::complex<double>(static_cast<double>(x), 0))); } template <class T> diff --git a/libcxx/test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp b/libcxx/test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp index 1afbe75efa5..8156d63f08d 100644 --- a/libcxx/test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp @@ -21,7 +21,7 @@ template <class T> void test1() { - for (int s = 0; s < 20; ++s) + for (T s = 0; s < 20; ++s) { typedef std::linear_congruential_engine<T, 2, 3, 7> E; E e1(s); diff --git a/libcxx/test/std/re/re.traits/value.pass.cpp b/libcxx/test/std/re/re.traits/value.pass.cpp index dfed66c35c4..737362ba631 100644 --- a/libcxx/test/std/re/re.traits/value.pass.cpp +++ b/libcxx/test/std/re/re.traits/value.pass.cpp @@ -116,7 +116,7 @@ int main() assert(t.value(c, 10) == -1); assert(t.value(c, 16) == c - 'a' +10); } - for (int c = 'g'; c < 0xFFFF; ++c) + for (wchar_t c = 'g'; c < 0xFFFF; ++c) { assert(t.value(c, 8) == -1); assert(t.value(c, 10) == -1); diff --git a/libcxx/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp index 7bd898bee44..60443e9f358 100644 --- a/libcxx/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp @@ -103,8 +103,8 @@ int main() test(100, 'a'); test(100, 'a', A(2)); - test(100, 65); - test(100, 65, A(3)); + test(static_cast<char>(100), static_cast<char>(65)); + test(static_cast<char>(100), static_cast<char>(65), A(3)); } #if TEST_STD_VER >= 11 { @@ -123,8 +123,8 @@ int main() test(100, 'a'); test(100, 'a', A()); - test(100, 65); - test(100, 65, A()); + test(static_cast<char>(100), static_cast<char>(65)); + test(static_cast<char>(100), static_cast<char>(65), A()); } #endif } diff --git a/libcxx/test/std/strings/string.view/string.view.hash/string_view.pass.cpp b/libcxx/test/std/strings/string.view/string.view.hash/string_view.pass.cpp index a3a8a72566d..63099e2c886 100644 --- a/libcxx/test/std/strings/string.view/string.view.hash/string_view.pass.cpp +++ b/libcxx/test/std/strings/string.view/string.view.hash/string_view.pass.cpp @@ -38,7 +38,7 @@ test() char_type g1 [ 10 ]; char_type g2 [ 10 ]; for ( int i = 0; i < 10; ++i ) - g1[i] = g2[9-i] = '0' + i; + g1[i] = g2[9-i] = static_cast<char_type>('0' + i); T s1(g1, 10); T s2(g2, 10); assert(h(s1) != h(s2)); diff --git a/libcxx/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp b/libcxx/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp index f61d93aefd8..0d4244b4d86 100644 --- a/libcxx/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp +++ b/libcxx/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp @@ -28,7 +28,7 @@ struct power T operator()(T a, T b) { - return std::pow(a, b); + return static_cast<T>(std::pow(a, b)); } }; diff --git a/libcxx/test/std/utilities/function.objects/unord.hash/integral.pass.cpp b/libcxx/test/std/utilities/function.objects/unord.hash/integral.pass.cpp index 8954f4f3664..234c30981f2 100644 --- a/libcxx/test/std/utilities/function.objects/unord.hash/integral.pass.cpp +++ b/libcxx/test/std/utilities/function.objects/unord.hash/integral.pass.cpp @@ -35,7 +35,7 @@ test() for (int i = 0; i <= 5; ++i) { - T t(i); + T t(static_cast<T>(i)); if (sizeof(T) <= sizeof(std::size_t)) { const std::size_t result = h(t); diff --git a/libcxx/test/std/utilities/utility/exchange/exchange.pass.cpp b/libcxx/test/std/utilities/utility/exchange/exchange.pass.cpp index 5ef0ac3b09f..2d01d6c8c8a 100644 --- a/libcxx/test/std/utilities/utility/exchange/exchange.pass.cpp +++ b/libcxx/test/std/utilities/utility/exchange/exchange.pass.cpp @@ -22,10 +22,10 @@ int main() int v = 12; assert ( std::exchange ( v, 23 ) == 12 ); assert ( v == 23 ); - assert ( std::exchange ( v, 67.2 ) == 23 ); + assert ( std::exchange ( v, static_cast<short>(67) ) == 23 ); assert ( v == 67 ); - assert ((std::exchange<int, float> ( v, {} )) == 67 ); + assert ((std::exchange<int, short> ( v, {} )) == 67 ); assert ( v == 0 ); } diff --git a/libcxx/test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp b/libcxx/test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp index 0f6957d4855..3586243f8ba 100644 --- a/libcxx/test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp +++ b/libcxx/test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp @@ -21,7 +21,7 @@ int main() { { typedef std::pair<int, short> P1; - P1 p1 = std::make_pair(3, 4); + P1 p1 = std::make_pair(3, static_cast<short>(4)); assert(p1.first == 3); assert(p1.second == 4); } @@ -29,13 +29,13 @@ int main() #if TEST_STD_VER >= 11 { typedef std::pair<std::unique_ptr<int>, short> P1; - P1 p1 = std::make_pair(std::unique_ptr<int>(new int(3)), 4); + P1 p1 = std::make_pair(std::unique_ptr<int>(new int(3)), static_cast<short>(4)); assert(*p1.first == 3); assert(p1.second == 4); } { typedef std::pair<std::unique_ptr<int>, short> P1; - P1 p1 = std::make_pair(nullptr, 4); + P1 p1 = std::make_pair(nullptr, static_cast<short>(4)); assert(p1.first == nullptr); assert(p1.second == 4); } @@ -43,7 +43,7 @@ int main() #if TEST_STD_VER >= 14 { typedef std::pair<int, short> P1; - constexpr P1 p1 = std::make_pair(3, 4); + constexpr P1 p1 = std::make_pair(3, static_cast<short>(4)); static_assert(p1.first == 3, ""); static_assert(p1.second == 4, ""); } |