diff --git a/include/boost/charconv/detail/dragonbox.hpp b/include/boost/charconv/detail/dragonbox.hpp index 7640904..6330db7 100644 --- a/include/boost/charconv/detail/dragonbox.hpp +++ b/include/boost/charconv/detail/dragonbox.hpp @@ -32,6 +32,11 @@ #include #include +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4127) // Conditional expression is constant (e.g. BOOST_IF_CONSTEXPR statements) +#endif + namespace boost { namespace charconv { namespace detail { // A floating-point traits class defines ways to interpret a bit pattern of given size as an @@ -376,7 +381,7 @@ struct dragonbox_signed_significand_bits // so we does this manually. BOOST_IF_CONSTEXPR (std::is_same::value && N == 2) { - return std::uint32_t(umul64(n, UINT32_C(1374389535)) >> 37); + return static_cast(umul64(n, UINT32_C(1374389535)) >> 37); } // Specialize for 64-bit division by 1000. // Ensure that the correctness condition is met. @@ -2877,7 +2882,8 @@ namespace to_chars_detail { char* to_chars>(std::uint64_t const significand, int exponent, char* buffer) noexcept { // Print significand by decomposing it into a 9-digit block and a 8-digit block. - std::uint32_t first_block, second_block; + std::uint32_t first_block; + std::uint32_t second_block {}; bool no_second_block; if (significand >= 100000000) { @@ -3082,4 +3088,8 @@ namespace to_chars_detail { }}} // Namespaces +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + #endif // BOOST_CHARCONV_DETAIL_DRAGONBOX_HPP diff --git a/test/to_chars_sprintf.cpp b/test/to_chars_sprintf.cpp index 512db8c..184c7fc 100644 --- a/test/to_chars_sprintf.cpp +++ b/test/to_chars_sprintf.cpp @@ -121,7 +121,7 @@ template void test_sprintf_float( T value, boost::charconv::chars_forma } else BOOST_IF_CONSTEXPR (std::is_same::value) { - max_value = 1e16; + max_value = static_cast(1e16); } if (fmt == boost::charconv::chars_format::general)