diff --git a/include/boost/charconv/detail/emulated128.hpp b/include/boost/charconv/detail/emulated128.hpp index e77133d0..281b031c 100644 --- a/include/boost/charconv/detail/emulated128.hpp +++ b/include/boost/charconv/detail/emulated128.hpp @@ -997,7 +997,7 @@ struct numeric_limits<boost::charconv::detail::uint128> BOOST_ATTRIBUTE_UNUSED static constexpr boost::charconv::detail::uint128 infinity() { return 0; } BOOST_ATTRIBUTE_UNUSED static constexpr boost::charconv::detail::uint128 quiet_NaN() { return 0; } BOOST_ATTRIBUTE_UNUSED static constexpr boost::charconv::detail::uint128 signaling_NaN() { return 0; } - BOOST_ATTRIBUTE_UNUSED static constexpr boost::charconv::detail::uint128 denorm_min() { return 0; } + BOOST_ATTRIBUTE_UNUSED static constexpr boost::charconv::detail::uint128 (denorm_min)() { return 0; } }; } // Namespace std diff --git a/include/boost/charconv/detail/fallback_routines.hpp b/include/boost/charconv/detail/fallback_routines.hpp index 681aef5a..94f87b82 100644 --- a/include/boost/charconv/detail/fallback_routines.hpp +++ b/include/boost/charconv/detail/fallback_routines.hpp @@ -158,7 +158,7 @@ from_chars_result from_chars_strtod_impl(const char* first, const char* last, T& #ifndef __INTEL_LLVM_COMPILER if (return_value == HUGE_VALF) #else - if (return_value >= std::numeric_limits<T>::max()) + if (return_value >= (std::numeric_limits<T>::max)()) #endif { r = {last, std::errc::result_out_of_range}; @@ -171,7 +171,7 @@ from_chars_result from_chars_strtod_impl(const char* first, const char* last, T& #ifndef __INTEL_LLVM_COMPILER if (return_value == HUGE_VAL) #else - if (return_value >= std::numeric_limits<T>::max()) + if (return_value >= (std::numeric_limits<T>::max)()) #endif { r = {last, std::errc::result_out_of_range}; @@ -184,7 +184,7 @@ from_chars_result from_chars_strtod_impl(const char* first, const char* last, T& #ifndef __INTEL_LLVM_COMPILER if (return_value == HUGE_VALL) #else - if (return_value >= std::numeric_limits<T>::max()) + if (return_value >= (std::numeric_limits<T>::max)()) #endif { r = {last, std::errc::result_out_of_range}; diff --git a/include/boost/charconv/detail/fast_float/parse_number.hpp b/include/boost/charconv/detail/fast_float/parse_number.hpp index 8205bf7c..9f71d45c 100644 --- a/include/boost/charconv/detail/fast_float/parse_number.hpp +++ b/include/boost/charconv/detail/fast_float/parse_number.hpp @@ -107,10 +107,10 @@ BOOST_FORCEINLINE bool rounds_to_nearest() noexcept { // The volatile keywoard prevents the compiler from computing the function // at compile-time. // There might be other ways to prevent compile-time optimizations (e.g., asm). - // The value does not need to be std::numeric_limits<float>::min(), any small + // The value does not need to be (std::numeric_limits<float>::min)(), any small // value so that 1 + x should round to 1 would do (after accounting for excess // precision, as in 387 instructions). - static volatile float fmin = std::numeric_limits<float>::min(); + static volatile float fmin = (std::numeric_limits<float>::min)(); float fmini = fmin; // we copy it so that it gets loaded at most once. // // Explanation: diff --git a/src/from_chars_float_impl.hpp b/src/from_chars_float_impl.hpp index 0571ab96..b0ed68d6 100644 --- a/src/from_chars_float_impl.hpp +++ b/src/from_chars_float_impl.hpp @@ -106,7 +106,7 @@ from_chars_result from_chars_float_impl(const char* first, const char* last, T& #ifndef __INTEL_LLVM_COMPILER if (return_val == HUGE_VALF || return_val == -HUGE_VALF) #else - if (return_val >= std::numeric_limits<T>::max() || return_val <= std::numeric_limits<T>::lowest()) + if (return_val >= (std::numeric_limits<T>::max)() || return_val <= std::numeric_limits<T>::lowest()) #endif { value = return_val; @@ -127,7 +127,7 @@ from_chars_result from_chars_float_impl(const char* first, const char* last, T& #ifndef __INTEL_LLVM_COMPILER if (return_val == HUGE_VAL || return_val == -HUGE_VAL) #else - if (return_val >= std::numeric_limits<T>::max() || return_val <= std::numeric_limits<T>::lowest()) + if (return_val >= (std::numeric_limits<T>::max)() || return_val <= std::numeric_limits<T>::lowest()) #endif { value = return_val; @@ -148,7 +148,7 @@ from_chars_result from_chars_float_impl(const char* first, const char* last, T& #ifndef __INTEL_LLVM_COMPILER if (return_val == HUGE_VALL || return_val == -HUGE_VALL) #else - if (return_val >= std::numeric_limits<T>::max() || return_val <= std::numeric_limits<T>::lowest()) + if (return_val >= (std::numeric_limits<T>::max)() || return_val <= std::numeric_limits<T>::lowest()) #endif { value = return_val; diff --git a/test/from_chars.cpp b/test/from_chars.cpp index ed7048f1..091091e6 100644 --- a/test/from_chars.cpp +++ b/test/from_chars.cpp @@ -32,15 +32,15 @@ void test_128bit_int() BOOST_TEST(v1 == test_value); #ifdef __GLIBCXX_TYPE_INT_N_0 - BOOST_TEST(std::numeric_limits<T>::max() > static_cast<T>(std::numeric_limits<unsigned long long>::max())); + BOOST_TEST((std::numeric_limits<T>::max)() > static_cast<T>((std::numeric_limits<unsigned long long>::max)())); #else BOOST_IF_CONSTEXPR (std::is_same<T, boost::int128_type>::value) { - BOOST_TEST(BOOST_CHARCONV_INT128_MAX > static_cast<T>(std::numeric_limits<unsigned long long>::max())); + BOOST_TEST(BOOST_CHARCONV_INT128_MAX > static_cast<T>((std::numeric_limits<unsigned long long>::max)())); } else { - BOOST_TEST(BOOST_CHARCONV_UINT128_MAX > static_cast<T>(std::numeric_limits<unsigned long long>::max())); + BOOST_TEST(BOOST_CHARCONV_UINT128_MAX > static_cast<T>((std::numeric_limits<unsigned long long>::max)())); } #endif } diff --git a/test/limits.cpp b/test/limits.cpp index d38e4a16..7fe02ca7 100644 --- a/test/limits.cpp +++ b/test/limits.cpp @@ -136,8 +136,8 @@ template<typename T> void test_integral() test_odr_use( &boost::charconv::limits<T>::max_chars10 ); test_odr_use( &boost::charconv::limits<T>::max_chars ); - test_integral( std::numeric_limits<T>::min() ); - test_integral( std::numeric_limits<T>::max() ); + test_integral( (std::numeric_limits<T>::min)() ); + test_integral( (std::numeric_limits<T>::max)() ); } template<typename T> void test_floating_point( T value ) @@ -205,10 +205,10 @@ template<typename T> void test_floating_point() test_odr_use( &boost::charconv::limits<T>::max_chars10 ); test_odr_use( &boost::charconv::limits<T>::max_chars ); - test_floating_point( std::numeric_limits<T>::min() ); - test_floating_point( -std::numeric_limits<T>::min() ); - test_floating_point( std::numeric_limits<T>::max() ); - test_floating_point( -std::numeric_limits<T>::max() ); + test_floating_point( (std::numeric_limits<T>::min)() ); + test_floating_point( -(std::numeric_limits<T>::min)() ); + test_floating_point( (std::numeric_limits<T>::max)() ); + test_floating_point( -(std::numeric_limits<T>::max)() ); } int main() diff --git a/test/roundtrip.cpp b/test/roundtrip.cpp index e5835a71..6c16cb65 100644 --- a/test/roundtrip.cpp +++ b/test/roundtrip.cpp @@ -219,8 +219,8 @@ template<class T> void test_roundtrip_uint128( int base ) template<class T> void test_roundtrip_bv( int base ) { - test_roundtrip_integers(std::numeric_limits<T>::min(), base); - test_roundtrip_integers(std::numeric_limits<T>::max(), base); + test_roundtrip_integers((std::numeric_limits<T>::min)(), base); + test_roundtrip_integers((std::numeric_limits<T>::max)(), base); } #ifdef BOOST_CHARCONV_HAS_INT128 @@ -388,10 +388,10 @@ template <> void test_roundtrip<long double>(long double value, boost::charconv: template<class T> void test_roundtrip_bv() { - test_roundtrip( std::numeric_limits<T>::min() ); - test_roundtrip( -std::numeric_limits<T>::min() ); - test_roundtrip( std::numeric_limits<T>::max() ); - test_roundtrip( +std::numeric_limits<T>::max() ); + test_roundtrip( (std::numeric_limits<T>::min)() ); + test_roundtrip( -(std::numeric_limits<T>::min)() ); + test_roundtrip( (std::numeric_limits<T>::max)() ); + test_roundtrip( +(std::numeric_limits<T>::max)() ); } // diff --git a/test/test_128bit_emulation.cpp b/test/test_128bit_emulation.cpp index b38cead5..570e764c 100644 --- a/test/test_128bit_emulation.cpp +++ b/test/test_128bit_emulation.cpp @@ -215,8 +215,8 @@ void test_memcpy() void test_limits() { - BOOST_TEST(std::numeric_limits<uint128>::min() == 0); - BOOST_TEST(std::numeric_limits<uint128>::max() == uint128(UINT64_MAX, UINT64_MAX)); + BOOST_TEST((std::numeric_limits<uint128>::min)() == 0); + BOOST_TEST((std::numeric_limits<uint128>::max)() == uint128(UINT64_MAX, UINT64_MAX)); BOOST_TEST(std::numeric_limits<uint128>::is_signed == false); BOOST_TEST(std::numeric_limits<uint128>::is_integer == true); BOOST_TEST(std::numeric_limits<uint128>::digits == CHAR_BIT * sizeof(std::uint64_t) * 2); diff --git a/test/test_128bit_native.cpp b/test/test_128bit_native.cpp index 61e1dd64..cd96a8eb 100644 --- a/test/test_128bit_native.cpp +++ b/test/test_128bit_native.cpp @@ -13,11 +13,11 @@ void test128() BOOST_TEST_EQ(r1.high, UINT64_C(0)); BOOST_TEST_EQ(r1.low, UINT64_C(1)); - auto r2 = boost::charconv::detail::umul128(10, std::numeric_limits<std::uint64_t>::max()); + auto r2 = boost::charconv::detail::umul128(10, (std::numeric_limits<std::uint64_t>::max)()); BOOST_TEST_EQ(r2.high, UINT64_C(9)); BOOST_TEST_EQ(r2.low, UINT64_C(18446744073709551606)); - auto r3 = boost::charconv::detail::umul128(std::numeric_limits<std::uint64_t>::max(), std::numeric_limits<std::uint64_t>::max()); + auto r3 = boost::charconv::detail::umul128((std::numeric_limits<std::uint64_t>::max)(), (std::numeric_limits<std::uint64_t>::max)()); BOOST_TEST_EQ(r3.high, UINT64_C(18446744073709551614)); BOOST_TEST_EQ(r3.low, UINT64_C(1)); } diff --git a/test/test_parser.cpp b/test/test_parser.cpp index 80c4c834..c1fef846 100644 --- a/test/test_parser.cpp +++ b/test/test_parser.cpp @@ -40,7 +40,7 @@ void test_integer() BOOST_TEST(r3.ec == std::errc::invalid_argument); // Get the maximum value of the significant type - constexpr auto max_sig_v = std::numeric_limits<decltype(significand)>::max(); + constexpr auto max_sig_v = (std::numeric_limits<decltype(significand)>::max)(); char max_sig_buf[boost::charconv::limits<decltype(significand)>::max_chars10 + 1u]; const auto r4 = boost::charconv::to_chars(max_sig_buf + 1, max_sig_buf + sizeof(max_sig_buf), max_sig_v); if (BOOST_TEST(r4)) { diff --git a/test/to_chars_float_STL_comp.cpp b/test/to_chars_float_STL_comp.cpp index 84894015..dec006b7 100644 --- a/test/to_chars_float_STL_comp.cpp +++ b/test/to_chars_float_STL_comp.cpp @@ -101,7 +101,7 @@ void test_spot(T val, boost::charconv::chars_format fmt = boost::charconv::chars } template <typename T> -void random_test(boost::charconv::chars_format fmt = boost::charconv::chars_format::general, T min_val = 0, T max_val = std::numeric_limits<T>::max()) +void random_test(boost::charconv::chars_format fmt = boost::charconv::chars_format::general, T min_val = 0, T max_val = (std::numeric_limits<T>::max)()) { std::mt19937_64 gen(42); @@ -168,8 +168,8 @@ void non_finite_test(boost::charconv::chars_format fmt = boost::charconv::chars_ template <typename T> void fixed_test() { - constexpr T upper_bound = std::is_same<T, double>::value ? T(std::numeric_limits<std::uint64_t>::max()) : - T(std::numeric_limits<std::uint32_t>::max()); + constexpr T upper_bound = std::is_same<T, double>::value ? T((std::numeric_limits<std::uint64_t>::max)()) : + T((std::numeric_limits<std::uint32_t>::max)()); std::mt19937_64 gen(42); std::uniform_real_distribution<T> dist(1, upper_bound); diff --git a/test/to_chars_sprintf.cpp b/test/to_chars_sprintf.cpp index 87c08ecc..3b1d73ab 100644 --- a/test/to_chars_sprintf.cpp +++ b/test/to_chars_sprintf.cpp @@ -480,18 +480,18 @@ template<class T> void test_sprintf_uint64() template<class T> void test_sprintf_bv() { - test_sprintf( std::numeric_limits<T>::min() ); - test_sprintf( std::numeric_limits<T>::max() ); + test_sprintf( (std::numeric_limits<T>::min)() ); + test_sprintf( (std::numeric_limits<T>::max)() ); } // floating point types, boundary values template<class T> void test_sprintf_bv_fp() { - test_sprintf_float( std::numeric_limits<T>::min(), boost::charconv::chars_format::scientific ); - test_sprintf_float( -std::numeric_limits<T>::min(), boost::charconv::chars_format::scientific ); - test_sprintf_float( std::numeric_limits<T>::max(), boost::charconv::chars_format::scientific ); - test_sprintf_float( -std::numeric_limits<T>::max(), boost::charconv::chars_format::scientific ); + test_sprintf_float( (std::numeric_limits<T>::min)(), boost::charconv::chars_format::scientific ); + test_sprintf_float( -(std::numeric_limits<T>::min)(), boost::charconv::chars_format::scientific ); + test_sprintf_float( (std::numeric_limits<T>::max)(), boost::charconv::chars_format::scientific ); + test_sprintf_float( -(std::numeric_limits<T>::max)(), boost::charconv::chars_format::scientific ); } #if BOOST_CHARCONV_LDBL_BITS > 64