From 05aa3c2a2d2b50fb20e5bb82a8d2c938596ec0c6 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 29 Mar 2023 17:27:13 +0200 Subject: [PATCH] Workaround for MSVC14.3 gotos in if constexpr blocks --- include/boost/charconv/detail/config.hpp | 7 +++++++ include/boost/charconv/detail/floff.hpp | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/boost/charconv/detail/config.hpp b/include/boost/charconv/detail/config.hpp index b2688d8..92b92f1 100644 --- a/include/boost/charconv/detail/config.hpp +++ b/include/boost/charconv/detail/config.hpp @@ -102,4 +102,11 @@ static_assert((BOOST_CHARCONV_ENDIAN_BIG_BYTE || BOOST_CHARCONV_ENDIAN_LITTLE_BY #define BOOST_CHARCONV_HAS_BUILTIN(x) false #endif +// Workaround for errors in MSVC 14.3 with gotos in if constexpr blocks +#if defined(_MSC_VER) && _MSC_VER == 1933 +# define BOOST_CHARCONV_IF_CONSTEXPR if +#else +# define BOOST_CHARCONV_IF_CONSTEXPR BOOST_IF_CONSTEXPR +#endif + #endif // BOOST_CHARCONV_DETAIL_CONFIG_HPP diff --git a/include/boost/charconv/detail/floff.hpp b/include/boost/charconv/detail/floff.hpp index 72a7b4a..a3eff79 100644 --- a/include/boost/charconv/detail/floff.hpp +++ b/include/boost/charconv/detail/floff.hpp @@ -3065,7 +3065,7 @@ namespace jkj { namespace floff { fixed_point_calculator::discard_upper( significand, blocks, cache_block_count); - BOOST_IF_CONSTEXPR (ExtendedCache::segment_length == 22) { + BOOST_CHARCONV_IF_CONSTEXPR (ExtendedCache::segment_length == 22) { // No rounding, continue. if (remaining_digits > digits_in_the_second_segment) { remaining_digits -= digits_in_the_second_segment; @@ -3792,7 +3792,7 @@ namespace jkj { namespace floff { } } // ExtendedCache::segment_length == 22 - else BOOST_IF_CONSTEXPR (ExtendedCache::segment_length == 252) { + else BOOST_CHARCONV_IF_CONSTEXPR (ExtendedCache::segment_length == 252) { int overlapping_digits = 252 - digits_in_the_second_segment; int remaining_subsegment_pairs = 14; @@ -4217,7 +4217,7 @@ case n: fixed_point_calculator::discard_upper( significand, blocks, cache_block_count); - BOOST_IF_CONSTEXPR (ExtendedCache::segment_length == 22) { + BOOST_CHARCONV_IF_CONSTEXPR (ExtendedCache::segment_length == 22) { // When at least two subsegments left. if (remaining_digits > 16) { std::uint64_t first_second_subsegments =