Skip to content

Commit

Permalink
Add BOOST_PREVENT_MACRO_SUBSTITUTION
Browse files Browse the repository at this point in the history
  • Loading branch information
mborland committed Mar 21, 2023
1 parent 5a50ec7 commit b1a95fa
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include/boost/math/ccmath/abs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace detail {
template <typename T>
constexpr T abs_impl(T x) noexcept
{
if (boost::math::ccmath::isnan(x))
if ((boost::math::ccmath::isnan)(x))
{
return std::numeric_limits<T>::quiet_NaN();
}
Expand Down
6 changes: 3 additions & 3 deletions include/boost/math/ccmath/isinf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
namespace boost::math::ccmath {

template <typename T>
constexpr bool isinf(T x) noexcept
constexpr bool isinf BOOST_PREVENT_MACRO_SUBSTITUTION(T x) noexcept
{
if(BOOST_MATH_IS_CONSTANT_EVALUATED(x))
{
Expand All @@ -41,11 +41,11 @@ constexpr bool isinf(T x) noexcept

if constexpr (!std::is_integral_v<T>)
{
return isinf(x);
return (isinf)(x);
}
else
{
return isinf(static_cast<double>(x));
return (isinf)(static_cast<double>(x));
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions include/boost/math/ccmath/isnan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
namespace boost::math::ccmath {

template <typename T>
inline constexpr bool isnan(T x)
inline constexpr bool isnan BOOST_PREVENT_MACRO_SUBSTITUTION(T x)
{
if(BOOST_MATH_IS_CONSTANT_EVALUATED(x))
{
Expand All @@ -33,11 +33,11 @@ inline constexpr bool isnan(T x)

if constexpr (!std::is_integral_v<T>)
{
return isnan(x);
return (isnan)(x);
}
else
{
return isnan(static_cast<double>(x));
return (isnan)(static_cast<double>(x));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions include/boost/math/ccmath/ldexp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions test/git_issue_430.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
// See: https://godbolt.org/z/Ev4ManrsW

#include <boost/math/special_functions/round.hpp>
#include <boost/math/special_functions/next.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <cstdint>
#include <cmath>

template <typename Real>
void test_llround_near_boundary()
Expand Down

0 comments on commit b1a95fa

Please sign in to comment.