diff --git a/include/boost/math/concepts/distributions.hpp b/include/boost/math/concepts/distributions.hpp index 538bbe702b..65378a2782 100644 --- a/include/boost/math/concepts/distributions.hpp +++ b/include/boost/math/concepts/distributions.hpp @@ -343,7 +343,7 @@ struct DistributionConcept template static void test_extra_members(const boost::math::hypergeometric_distribution& d) { - unsigned u = d.defective(); + unsigned u = static_cast(d.defective()); u = d.sample_count(); u = d.total(); suppress_unused_variable_warning(u); diff --git a/include/boost/math/distributions/cauchy.hpp b/include/boost/math/distributions/cauchy.hpp index 82ace8f1b5..a266608bcd 100644 --- a/include/boost/math/distributions/cauchy.hpp +++ b/include/boost/math/distributions/cauchy.hpp @@ -276,29 +276,30 @@ inline RealType quantile(const complemented2_type inline RealType mean(const cauchy_distribution&) -{ // There is no mean: - typedef typename Policy::assert_undefined_type assert_type; - static_assert(assert_type::value == 0, "assert type is undefined"); - - return policies::raise_domain_error( - "boost::math::mean(cauchy<%1%>&)", - "The Cauchy distribution does not have a mean: " - "the only possible return value is %1%.", - std::numeric_limits::quiet_NaN(), Policy()); +{ + // There is no mean: + return + policies::raise_domain_error + ( + "boost::math::mean(cauchy<%1%>&)", + "The Cauchy distribution does not have a mean: " + "the only possible return value is %1%.", + std::numeric_limits::quiet_NaN(), Policy() + ); } template inline RealType variance(const cauchy_distribution& /*dist*/) { // There is no variance: - typedef typename Policy::assert_undefined_type assert_type; - static_assert(assert_type::value == 0, "assert type is undefined"); - - return policies::raise_domain_error( - "boost::math::variance(cauchy<%1%>&)", - "The Cauchy distribution does not have a variance: " - "the only possible return value is %1%.", - std::numeric_limits::quiet_NaN(), Policy()); + return + policies::raise_domain_error + ( + "boost::math::variance(cauchy<%1%>&)", + "The Cauchy distribution does not have a variance: " + "the only possible return value is %1%.", + std::numeric_limits::quiet_NaN(), Policy() + ); } template @@ -316,42 +317,42 @@ template inline RealType skewness(const cauchy_distribution& /*dist*/) { // There is no skewness: - typedef typename Policy::assert_undefined_type assert_type; - static_assert(assert_type::value == 0, "assert type is undefined"); - - return policies::raise_domain_error( - "boost::math::skewness(cauchy<%1%>&)", - "The Cauchy distribution does not have a skewness: " - "the only possible return value is %1%.", - std::numeric_limits::quiet_NaN(), Policy()); // infinity? + return + policies::raise_domain_error + ( + "boost::math::skewness(cauchy<%1%>&)", + "The Cauchy distribution does not have a skewness: " + "the only possible return value is %1%.", + std::numeric_limits::quiet_NaN(), Policy() + ); } template inline RealType kurtosis(const cauchy_distribution& /*dist*/) { // There is no kurtosis: - typedef typename Policy::assert_undefined_type assert_type; - static_assert(assert_type::value == 0, "assert type is undefined"); - - return policies::raise_domain_error( - "boost::math::kurtosis(cauchy<%1%>&)", - "The Cauchy distribution does not have a kurtosis: " - "the only possible return value is %1%.", - std::numeric_limits::quiet_NaN(), Policy()); + return + policies::raise_domain_error + ( + "boost::math::kurtosis(cauchy<%1%>&)", + "The Cauchy distribution does not have a kurtosis: " + "the only possible return value is %1%.", + std::numeric_limits::quiet_NaN(), Policy() + ); } template inline RealType kurtosis_excess(const cauchy_distribution& /*dist*/) { // There is no kurtosis excess: - typedef typename Policy::assert_undefined_type assert_type; - static_assert(assert_type::value == 0, "assert type is undefined"); - - return policies::raise_domain_error( - "boost::math::kurtosis_excess(cauchy<%1%>&)", - "The Cauchy distribution does not have a kurtosis: " - "the only possible return value is %1%.", - std::numeric_limits::quiet_NaN(), Policy()); + return + policies::raise_domain_error + ( + "boost::math::kurtosis_excess(cauchy<%1%>&)", + "The Cauchy distribution does not have a kurtosis: " + "the only possible return value is %1%.", + std::numeric_limits::quiet_NaN(), Policy() + ); } template diff --git a/include/boost/math/distributions/detail/hypergeometric_pdf.hpp b/include/boost/math/distributions/detail/hypergeometric_pdf.hpp index 9eeef270d8..dcdc5ac7b5 100644 --- a/include/boost/math/distributions/detail/hypergeometric_pdf.hpp +++ b/include/boost/math/distributions/detail/hypergeometric_pdf.hpp @@ -321,7 +321,8 @@ T hypergeometric_pdf_prime_loop_imp(hypergeometric_pdf_prime_loop_data& data, hy // to sidestep the issue: // hypergeometric_pdf_prime_loop_result_entry t = { p, &result }; - data.current_prime = prime(++data.prime_index); + ++data.prime_index; + data.current_prime = prime(static_cast(data.prime_index)); return hypergeometric_pdf_prime_loop_imp(data, t); } if((p < 1) && (tools::min_value() / p > result.value)) @@ -331,12 +332,14 @@ T hypergeometric_pdf_prime_loop_imp(hypergeometric_pdf_prime_loop_data& data, hy // to sidestep the issue: // hypergeometric_pdf_prime_loop_result_entry t = { p, &result }; - data.current_prime = prime(++data.prime_index); + ++data.prime_index; + data.current_prime = prime(static_cast(data.prime_index)); return hypergeometric_pdf_prime_loop_imp(data, t); } result.value *= p; } - data.current_prime = prime(++data.prime_index); + ++data.prime_index; + data.current_prime = prime(static_cast(data.prime_index)); } // // When we get to here we have run out of prime factors, @@ -397,16 +400,16 @@ T hypergeometric_pdf_factorial_imp(std::uint64_t x, std::uint64_t r, std::uint64 BOOST_MATH_ASSERT(N <= boost::math::max_factorial::value); T result = boost::math::unchecked_factorial(n); T num[3] = { - boost::math::unchecked_factorial(r), - boost::math::unchecked_factorial(N - n), - boost::math::unchecked_factorial(N - r) + boost::math::unchecked_factorial(static_cast(r)), + boost::math::unchecked_factorial(static_cast(N - n)), + boost::math::unchecked_factorial(static_cast(N - r)) }; T denom[5] = { - boost::math::unchecked_factorial(N), - boost::math::unchecked_factorial(x), - boost::math::unchecked_factorial(n - x), - boost::math::unchecked_factorial(r - x), - boost::math::unchecked_factorial(N - n - r + x) + boost::math::unchecked_factorial(static_cast(N)), + boost::math::unchecked_factorial(static_cast(x)), + boost::math::unchecked_factorial(static_cast(n - x)), + boost::math::unchecked_factorial(static_cast(r - x)), + boost::math::unchecked_factorial(static_cast(N - n - r + x)) }; std::size_t i = 0; std::size_t j = 0; diff --git a/include/boost/math/distributions/non_central_beta.hpp b/include/boost/math/distributions/non_central_beta.hpp index b32a605f21..07a85b3a2b 100644 --- a/include/boost/math/distributions/non_central_beta.hpp +++ b/include/boost/math/distributions/non_central_beta.hpp @@ -806,24 +806,34 @@ namespace boost // standard_deviation provided by derived accessors. template inline RealType skewness(const non_central_beta_distribution& /*dist*/) - { // skewness = sqrt(l). + { + // LCOV_EXCL_START const char* function = "boost::math::non_central_beta_distribution<%1%>::skewness()"; - typedef typename Policy::assert_undefined_type assert_type; - static_assert(assert_type::value == 0, "Assert type is undefined."); - return policies::raise_evaluation_error(function, "This function is not yet implemented, the only sensible result is %1%.", // LCOV_EXCL_LINE - std::numeric_limits::quiet_NaN(), Policy()); // infinity? LCOV_EXCL_LINE + return + policies::raise_evaluation_error + ( + function, + "This function is not yet implemented, the only sensible result is %1%.", // LCOV_EXCL_LINE + std::numeric_limits::quiet_NaN(), Policy() + ); + // LCOV_EXCL_STOP } template inline RealType kurtosis_excess(const non_central_beta_distribution& /*dist*/) { + // LCOV_EXCL_START const char* function = "boost::math::non_central_beta_distribution<%1%>::kurtosis_excess()"; - typedef typename Policy::assert_undefined_type assert_type; - static_assert(assert_type::value == 0, "Assert type is undefined."); - return policies::raise_evaluation_error(function, "This function is not yet implemented, the only sensible result is %1%.", // LCOV_EXCL_LINE - std::numeric_limits::quiet_NaN(), Policy()); // infinity? LCOV_EXCL_LINE + return + policies::raise_evaluation_error + ( + function, + "This function is not yet implemented, the only sensible result is %1%.", + std::numeric_limits::quiet_NaN(), Policy() + ); + // LCOV_EXCL_STOP } // kurtosis_excess template diff --git a/test/compile_test/instantiate.hpp b/test/compile_test/instantiate.hpp index 3783ec17ee..0a715516f3 100644 --- a/test/compile_test/instantiate.hpp +++ b/test/compile_test/instantiate.hpp @@ -8,6 +8,10 @@ #ifndef BOOST_LIBS_MATH_TEST_INSTANTIATE_HPP #define BOOST_LIBS_MATH_TEST_INSTANTIATE_HPP +#if !defined(BOOST_MATH_ASSERT_UNDEFINED_POLICY) +#define BOOST_MATH_ASSERT_UNDEFINED_POLICY false +#endif + template struct instantiate_runner_result { @@ -17,12 +21,6 @@ struct instantiate_runner_result template bool instantiate_runner_result::value; -#if defined(BOOST_MATH_ASSERT_UNDEFINED_POLICY) -#undef BOOST_MATH_ASSERT_UNDEFINED_POLICY -#endif - -#define BOOST_MATH_ASSERT_UNDEFINED_POLICY false - #include #if !defined(BOOST_MATH_STANDALONE) @@ -90,7 +88,7 @@ void instantiate(RealType) function_requires > >(); function_requires > >(); function_requires > >(); - //function_requires > >(); + function_requires > >(); function_requires > >(); function_requires > >(); function_requires > >(); @@ -108,7 +106,7 @@ void instantiate(RealType) function_requires > >(); function_requires > >(); function_requires > >(); - //function_requires > >(); + function_requires > >(); function_requires > >(); function_requires > >(); function_requires > >(); @@ -127,7 +125,7 @@ void instantiate(RealType) function_requires > >(); function_requires > >(); function_requires > >(); - //function_requires > >(); + function_requires > >(); function_requires > >(); function_requires > >(); function_requires > >(); @@ -144,7 +142,7 @@ void instantiate(RealType) function_requires > >(); function_requires > >(); function_requires > >(); - //function_requires > >(); + function_requires > >(); function_requires > >(); function_requires > >(); function_requires > >(); @@ -162,7 +160,7 @@ void instantiate(RealType) function_requires >(); function_requires >(); function_requires >(); - //function_requires >(); + function_requires >(); function_requires >(); function_requires >(); function_requires >(); @@ -178,7 +176,7 @@ void instantiate(RealType) function_requires >(); function_requires >(); function_requires >(); - //function_requires >(); + function_requires >(); function_requires >(); function_requires >(); function_requires >();