Skip to content

Commit d87ce89

Browse files
committed
Check validity of initial policy
1 parent dc23aa3 commit d87ce89

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

include/boost/math/policies/policy.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,14 +1007,19 @@ struct is_noexcept_error_policy
10071007
// For example if a special function for float promotes to double, we don't want the next
10081008
// function in the call chain to then promote to long double
10091009
template <typename Policy>
1010-
using make_forwarding_policy =
1010+
struct make_forwarding_policy
1011+
{
1012+
static_assert(detail::is_valid_policy<Policy>::value, "Policy must be valid to make a forwarding policy");
1013+
1014+
using type =
10111015
typename policies::normalise<
10121016
Policy,
10131017
policies::promote_float<false>,
10141018
policies::promote_double<false>,
10151019
policies::discrete_quantile<>,
10161020
policies::assert_undefined<>
10171021
>::type;
1022+
};
10181023

10191024
template <typename Policy>
10201025
using make_forwarding_policy_t = typename make_forwarding_policy<Policy>::type;

0 commit comments

Comments
 (0)