From b1a95fa2c154ef52d447c18edb9ee0bab326e0aa Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 20 Mar 2023 17:03:47 -0700 Subject: [PATCH] Add BOOST_PREVENT_MACRO_SUBSTITUTION --- include/boost/math/ccmath/abs.hpp | 2 +- include/boost/math/ccmath/isinf.hpp | 6 +++--- include/boost/math/ccmath/isnan.hpp | 6 +++--- include/boost/math/ccmath/ldexp.hpp | 4 ++-- test/git_issue_430.cpp | 2 ++ 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/include/boost/math/ccmath/abs.hpp b/include/boost/math/ccmath/abs.hpp index fa798eba1..84e01fba0 100644 --- a/include/boost/math/ccmath/abs.hpp +++ b/include/boost/math/ccmath/abs.hpp @@ -31,7 +31,7 @@ namespace detail { template constexpr T abs_impl(T x) noexcept { - if (boost::math::ccmath::isnan(x)) + if ((boost::math::ccmath::isnan)(x)) { return std::numeric_limits::quiet_NaN(); } diff --git a/include/boost/math/ccmath/isinf.hpp b/include/boost/math/ccmath/isinf.hpp index 706b9605c..88544d2ab 100644 --- a/include/boost/math/ccmath/isinf.hpp +++ b/include/boost/math/ccmath/isinf.hpp @@ -22,7 +22,7 @@ namespace boost::math::ccmath { template -constexpr bool isinf(T x) noexcept +constexpr bool isinf BOOST_PREVENT_MACRO_SUBSTITUTION(T x) noexcept { if(BOOST_MATH_IS_CONSTANT_EVALUATED(x)) { @@ -41,11 +41,11 @@ constexpr bool isinf(T x) noexcept if constexpr (!std::is_integral_v) { - return isinf(x); + return (isinf)(x); } else { - return isinf(static_cast(x)); + return (isinf)(static_cast(x)); } } } diff --git a/include/boost/math/ccmath/isnan.hpp b/include/boost/math/ccmath/isnan.hpp index ca915a464..c17e03373 100644 --- a/include/boost/math/ccmath/isnan.hpp +++ b/include/boost/math/ccmath/isnan.hpp @@ -21,7 +21,7 @@ namespace boost::math::ccmath { template -inline constexpr bool isnan(T x) +inline constexpr bool isnan BOOST_PREVENT_MACRO_SUBSTITUTION(T x) { if(BOOST_MATH_IS_CONSTANT_EVALUATED(x)) { @@ -33,11 +33,11 @@ inline constexpr bool isnan(T x) if constexpr (!std::is_integral_v) { - return isnan(x); + return (isnan)(x); } else { - return isnan(static_cast(x)); + return (isnan)(static_cast(x)); } } } diff --git a/include/boost/math/ccmath/ldexp.hpp b/include/boost/math/ccmath/ldexp.hpp index 92277706f..31730b265 100644 --- a/include/boost/math/ccmath/ldexp.hpp +++ b/include/boost/math/ccmath/ldexp.hpp @@ -45,8 +45,8 @@ inline constexpr Real ldexp(Real arg, int exp) noexcept if(BOOST_MATH_IS_CONSTANT_EVALUATED(arg)) { return boost::math::ccmath::abs(arg) == Real(0) ? arg : - boost::math::ccmath::isinf(arg) ? arg : - boost::math::ccmath::isnan(arg) ? arg : + (boost::math::ccmath::isinf)(arg) ? arg : + (boost::math::ccmath::isnan)(arg) ? arg : boost::math::ccmath::detail::ldexp_impl(arg, exp); } else diff --git a/test/git_issue_430.cpp b/test/git_issue_430.cpp index 907bc9ed5..d7274601e 100644 --- a/test/git_issue_430.cpp +++ b/test/git_issue_430.cpp @@ -7,9 +7,11 @@ // See: https://godbolt.org/z/Ev4ManrsW #include +#include #define BOOST_TEST_MAIN #include #include +#include template void test_llround_near_boundary()