diff --git a/doc/internals/polynomial.qbk b/doc/internals/polynomial.qbk index 7860d995a6..b5c6b5fedf 100644 --- a/doc/internals/polynomial.qbk +++ b/doc/internals/polynomial.qbk @@ -21,8 +21,8 @@ polynomial(){} template polynomial(const U* data, unsigned order); - template - polynomial(I first, I last); + template + polynomial(Iterator first, Iterator last); template explicit polynomial(const U& point, typename std::enable_if >::type* = nullptr); diff --git a/include/boost/math/bindings/mpfr.hpp b/include/boost/math/bindings/mpfr.hpp index ceb1f75790..711daded77 100644 --- a/include/boost/math/bindings/mpfr.hpp +++ b/include/boost/math/bindings/mpfr.hpp @@ -304,8 +304,8 @@ inline int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpfr_class) namespace detail{ -template -void convert_to_long_result(mpfr_class const& r, I& result) +template +void convert_to_long_result(mpfr_class const& r, Integer& result) { result = 0; I last_result(0); diff --git a/include/boost/math/bindings/mpreal.hpp b/include/boost/math/bindings/mpreal.hpp index e8b6c4036a..3271550110 100644 --- a/include/boost/math/bindings/mpreal.hpp +++ b/include/boost/math/bindings/mpreal.hpp @@ -264,8 +264,8 @@ inline int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpfr::mpr namespace detail{ -template -void convert_to_long_result(mpfr::mpreal const& r, I& result) +template(boost::math::ntl::RR t) namespace detail{ -template -void convert_to_long_result(NTL::RR const& r, I& result) +template +void convert_to_long_result(NTL::RR const& r, Integer& result) { result = 0; I last_result(0); diff --git a/include/boost/math/special_functions.hpp b/include/boost/math/special_functions.hpp index af93198765..5d67167a62 100644 --- a/include/boost/math/special_functions.hpp +++ b/include/boost/math/special_functions.hpp @@ -82,4 +82,5 @@ #ifndef BOOST_NO_EXCEPTIONS #include #endif + #endif // BOOST_MATH_SPECIAL_FUNCTIONS_HPP diff --git a/include/boost/math/special_functions/bessel.hpp b/include/boost/math/special_functions/bessel.hpp index 35ad350262..5fe518a365 100644 --- a/include/boost/math/special_functions/bessel.hpp +++ b/include/boost/math/special_functions/bessel.hpp @@ -112,9 +112,9 @@ T cyl_bessel_j_imp(T v, T x, const bessel_no_int_tag& t, const Policy& pol) "Got x = %1%, but we need x >= 0", x, pol); } - T j, y; - bessel_jy(v, x, &j, &y, need_j, pol); - return j; + T result_J, y; + bessel_jy(v, x, &result_J, &y, need_j, pol); + return result_J; } template @@ -221,9 +221,9 @@ T cyl_bessel_i_imp(T v, T x, const Policy& pol) } if((v > 0) && (x / v < 0.25)) return bessel_i_small_z_series(v, x, pol); - T I, K; - bessel_ik(v, x, &I, &K, need_i, pol); - return I; + T result_I, result_K; + bessel_ik(v, x, &result_I, &result_K, need_i, pol); + return result_I; } template @@ -244,9 +244,9 @@ inline T cyl_bessel_k_imp(T v, T x, const bessel_no_int_tag& /* t */, const Poli function, "Got x = %1%, but we need x > 0", x, pol); } - T I, K; - bessel_ik(v, x, &I, &K, need_k, pol); - return K; + T result_I, result_K; + bessel_ik(v, x, &result_I, &result_K, need_k, pol); + return result_K; } template @@ -282,8 +282,8 @@ inline T cyl_neumann_imp(T v, T x, const bessel_no_int_tag&, const Policy& pol) function, "Got x = %1%, but result is complex for x <= 0", x, pol); } - T j, y; - bessel_jy(v, x, &j, &y, need_y, pol); + T result_J, y; + bessel_jy(v, x, &result_J, &y, need_y, pol); // // Post evaluation check for internal overflow during evaluation, // can occur when x is small and v is large, in which case the result diff --git a/include/boost/math/special_functions/detail/bessel_ik.hpp b/include/boost/math/special_functions/detail/bessel_ik.hpp index f6d222db11..7d0a4e79fe 100644 --- a/include/boost/math/special_functions/detail/bessel_ik.hpp +++ b/include/boost/math/special_functions/detail/bessel_ik.hpp @@ -80,7 +80,7 @@ inline T bessel_i_small_z_series(T v, T x, const Policy& pol) // Calculate K(v, x) and K(v+1, x) by method analogous to // Temme, Journal of Computational Physics, vol 21, 343 (1976) template -int temme_ik(T v, T x, T* K, T* K1, const Policy& pol) +int temme_ik(T v, T x, T* result_K, T* K1, const Policy& pol) { T f, h, p, q, coef, sum, sum1, tolerance; T a, b, c, d, sigma, gamma1, gamma2; @@ -148,7 +148,7 @@ int temme_ik(T v, T x, T* K, T* K1, const Policy& pol) } policies::check_series_iterations("boost::math::bessel_ik<%1%>(%1%,%1%) in temme_ik", k, pol); - *K = sum; + *result_K = sum; *K1 = 2 * sum1 / x; return 0; @@ -297,7 +297,7 @@ enum{ // Compute I(v, x) and K(v, x) simultaneously by Temme's method, see // Temme, Journal of Computational Physics, vol 19, 324 (1975) template -int bessel_ik(T v, T x, T* I, T* K, int kind, const Policy& pol) +int bessel_ik(T v, T x, T* result_I, T* result_K, int kind, const Policy& pol) { // Kv1 = K_(v+1), fv = I_(v+1) / I_v // Ku1 = K_(u+1), fu = I_(u+1) / I_u @@ -329,7 +329,7 @@ int bessel_ik(T v, T x, T* I, T* K, int kind, const Policy& pol) if (x < 0) { - *I = *K = policies::raise_domain_error(function, + *result_I = *result_K = policies::raise_domain_error(function, "Got x = %1% but real argument x must be non-negative, complex number result not supported.", x, pol); return 1; } @@ -353,8 +353,8 @@ int bessel_ik(T v, T x, T* I, T* K, int kind, const Policy& pol) policies::raise_overflow_error(function, nullptr, pol); // reflection formula } - *I = Iv; - *K = Kv; + *result_I = Iv; + *result_K = Kv; return 0; } @@ -433,22 +433,22 @@ int bessel_ik(T v, T x, T* I, T* K, int kind, const Policy& pol) T z = (u + n % 2); T fact = (2 / pi()) * (boost::math::sin_pi(z, pol) * Kv); if(fact == 0) - *I = Iv; + *result_I = Iv; else if(tools::max_value() * scale < fact) - *I = (org_kind & need_i) ? T(sign(fact) * scale_sign * policies::raise_overflow_error(function, nullptr, pol)) : T(0); + *result_I = (org_kind & need_i) ? T(sign(fact) * scale_sign * policies::raise_overflow_error(function, nullptr, pol)) : T(0); else - *I = Iv + fact / scale; // reflection formula + *result_I = Iv + fact / scale; // reflection formula } else { - *I = Iv; + *result_I = Iv; } if(tools::max_value() * scale < Kv) - *K = (org_kind & need_k) ? T(sign(Kv) * scale_sign * policies::raise_overflow_error(function, nullptr, pol)) : T(0); + *result_K = (org_kind & need_k) ? T(sign(Kv) * scale_sign * policies::raise_overflow_error(function, nullptr, pol)) : T(0); else - *K = Kv / scale; - BOOST_MATH_INSTRUMENT_VARIABLE(*I); - BOOST_MATH_INSTRUMENT_VARIABLE(*K); + *result_K = Kv / scale; + BOOST_MATH_INSTRUMENT_VARIABLE(*result_I); + BOOST_MATH_INSTRUMENT_VARIABLE(*result_K); return 0; } diff --git a/include/boost/math/tools/convert_from_string.hpp b/include/boost/math/tools/convert_from_string.hpp index f6fe08aeeb..3b7895cdf6 100644 --- a/include/boost/math/tools/convert_from_string.hpp +++ b/include/boost/math/tools/convert_from_string.hpp @@ -14,7 +14,18 @@ #include #include #ifndef BOOST_MATH_STANDALONE + +#if defined(_MSC_VER) || defined(__GNUC__) +# pragma push_macro( "I" ) +# undef I +#endif + #include + +#if defined(_MSC_VER) || defined(__GNUC__) +# pragma pop_macro( "I" ) +#endif + #endif namespace boost{ namespace math{ namespace tools{ diff --git a/include/boost/math/tools/mp.hpp b/include/boost/math/tools/mp.hpp index 3100a0bb67..55aac1b092 100644 --- a/include/boost/math/tools/mp.hpp +++ b/include/boost/math/tools/mp.hpp @@ -168,11 +168,11 @@ struct mp_at_c, 1 }; } -template -using mp_at_c = typename detail::mp_at_c::type; +template +using mp_at_c = typename detail::mp_at_c::type; -template -using mp_at = typename detail::mp_at_c::type; +template +using mp_at = typename detail::mp_at_c::type; // Back template @@ -339,8 +339,8 @@ using mp_remove_if_q = mp_remove_if; // Index sequence // Use C++14 index sequence if available #if defined(__cpp_lib_integer_sequence) && (__cpp_lib_integer_sequence >= 201304) -template -using index_sequence = std::index_sequence; +template +using index_sequence = std::index_sequence; template using make_index_sequence = std::make_index_sequence; @@ -350,11 +350,11 @@ using index_sequence_for = std::index_sequence_for; #else -template +template struct integer_sequence {}; -template -using index_sequence = integer_sequence; +template +using index_sequence = integer_sequence; namespace detail { @@ -385,10 +385,10 @@ struct iseq_identity template struct append_integer_sequence {}; -template -struct append_integer_sequence, integer_sequence> +template +struct append_integer_sequence, integer_sequence> { - using type = integer_sequence; + using type = integer_sequence; }; template diff --git a/include/boost/math/tools/polynomial.hpp b/include/boost/math/tools/polynomial.hpp index fdff23254c..6f9b9039fd 100644 --- a/include/boost/math/tools/polynomial.hpp +++ b/include/boost/math/tools/polynomial.hpp @@ -292,15 +292,15 @@ class polynomial normalize(); } - template - polynomial(I first, I last) + template + polynomial(Iterator first, Iterator last) : m_data(first, last) { normalize(); } - template - polynomial(I first, unsigned length) + template + polynomial(Iterator first, unsigned length) : m_data(first, std::next(first, length + 1)) { normalize(); diff --git a/include/boost/math/tools/throw_exception.hpp b/include/boost/math/tools/throw_exception.hpp index 56a2c9c3e0..2cfc83a01c 100644 --- a/include/boost/math/tools/throw_exception.hpp +++ b/include/boost/math/tools/throw_exception.hpp @@ -10,9 +10,18 @@ #ifndef BOOST_MATH_STANDALONE +#if defined(_MSC_VER) || defined(__GNUC__) +# pragma push_macro( "I" ) +# undef I +#endif + #include #define BOOST_MATH_THROW_EXCEPTION(expr) boost::throw_exception(expr); +#if defined(_MSC_VER) || defined(__GNUC__) +# pragma pop_macro( "I" ) +#endif + #else // Standalone mode - use standard library facilities #define BOOST_MATH_THROW_EXCEPTION(expr) throw expr; diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 34a3ce7779..fd1db67659 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -904,6 +904,7 @@ test-suite distribution_tests : [ run scipy_issue_17916_nct.cpp ../../test/build//boost_unit_test_framework ] [ run scipy_issue_18302.cpp ../../test/build//boost_unit_test_framework ] [ run scipy_issue_18511.cpp ../../test/build//boost_unit_test_framework ] + [ compile scipy_issue_19762.cpp ] ; test-suite new_floats : diff --git a/test/scipy_issue_19762.cpp b/test/scipy_issue_19762.cpp new file mode 100644 index 0000000000..01a96956e6 --- /dev/null +++ b/test/scipy_issue_19762.cpp @@ -0,0 +1,15 @@ +// Copyright John Maddock, 2023 +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// https://github.com/scipy/scipy/issues/19726#issuecomment-1866143568 + +#include +#include +#include + +int main() +{ + return 0; +}