diff --git a/include/boost/charconv/detail/config.hpp b/include/boost/charconv/detail/config.hpp index f07326f..4e5222b 100644 --- a/include/boost/charconv/detail/config.hpp +++ b/include/boost/charconv/detail/config.hpp @@ -118,4 +118,13 @@ static_assert((BOOST_CHARCONV_ENDIAN_BIG_BYTE || BOOST_CHARCONV_ENDIAN_LITTLE_BY #define BOOST_CHARCONV_SAFEBUFFERS #endif +// Clang < 4 return type deduction does not work with the policy implementation +#ifndef BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION +# if defined(__clang__) && __clang_major__ < 4 +# define BOOST_CHARCONV_NO_CXX14_RETURN_TYPE_DEDUCTION +# endif +#elif defined(BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION) +# define BOOST_CHARCONV_NO_CXX14_RETURN_TYPE_DEDUCTION +#endif + #endif // BOOST_CHARCONV_DETAIL_CONFIG_HPP diff --git a/include/boost/charconv/detail/dragonbox.hpp b/include/boost/charconv/detail/dragonbox.hpp index 520b20b..ef301c0 100644 --- a/include/boost/charconv/detail/dragonbox.hpp +++ b/include/boost/charconv/detail/dragonbox.hpp @@ -2287,7 +2287,7 @@ namespace policy_impl { template struct policy_holder : Policies... {}; - #ifndef BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION + #ifndef BOOST_CHARCONV_NO_CXX14_RETURN_TYPE_DEDUCTION template constexpr auto make_policy_holder_impl(base_default_pair_list<>, found_policy_pair_list, Policies...) @@ -2351,14 +2351,14 @@ template , BOOST_FORCEINLINE BOOST_CHARCONV_SAFEBUFFERS auto to_decimal(dragonbox_signed_significand_bits dragonbox_signed_significand_bits, unsigned int exponent_bits, BOOST_ATTRIBUTE_UNUSED Policies... policies) noexcept - #ifdef BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION + #ifdef BOOST_CHARCONV_NO_CXX14_RETURN_TYPE_DEDUCTION -> decimal_fp #endif { // Build policy holder type. using namespace policy_impl; - #ifdef BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION + #ifdef BOOST_CHARCONV_NO_CXX14_RETURN_TYPE_DEDUCTION // For C++11 we hardcode the policy holder using policy_holder = policy_holder; @@ -2506,7 +2506,7 @@ to_decimal(dragonbox_signed_significand_bits dragonbox_signe template , typename... Policies> BOOST_FORCEINLINE BOOST_CHARCONV_SAFEBUFFERS auto to_decimal(Float x, Policies... policies) noexcept - #ifdef BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION + #ifdef BOOST_CHARCONV_NO_CXX14_RETURN_TYPE_DEDUCTION -> decimal_fp #endif { @@ -2570,7 +2570,7 @@ char* to_chars_n(Float x, char* buffer, BOOST_ATTRIBUTE_UNUSED Policies... polic { using namespace policy_impl; - #ifdef BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION + #ifdef BOOST_CHARCONV_NO_CXX14_RETURN_TYPE_DEDUCTION // For C++11 we hardcode the policy holder using policy_holder = policy_holder;