From 64ea2072b378ea8bfdad1778bb4be4223f8351f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Agenor?= Date: Mon, 5 Sep 2022 22:42:05 -0300 Subject: [PATCH] Workaround to make Intel LLVM 16 happy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit + The compiler interprets sign as a bit-field and throws an error in the lambda capture by reference Signed-off-by: André Agenor --- include/fmt/format.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index a1b98c7f..4aff0e93 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2415,8 +2415,7 @@ FMT_CONSTEXPR20 auto do_write_float(OutputIt out, const DecimalFP& f, auto significand = f.significand; int significand_size = get_significand_size(f); const Char zero = static_cast('0'); - auto sign = fspecs.sign; - size_t size = to_unsigned(significand_size) + (sign ? 1 : 0); + size_t size = to_unsigned(significand_size) + (fspecs.sign ? 1 : 0); using iterator = reserve_iterator; Char decimal_point = @@ -2448,7 +2447,7 @@ FMT_CONSTEXPR20 auto do_write_float(OutputIt out, const DecimalFP& f, size += to_unsigned((decimal_point ? 1 : 0) + 2 + exp_digits); char exp_char = fspecs.upper ? 'E' : 'e'; auto write = [=](iterator it) { - if (sign) *it++ = detail::sign(sign); + if (fspecs.sign) *it++ = detail::sign(fspecs.sign); // Insert a decimal point after the first digit and add an exponent. it = write_significand(it, significand, significand_size, 1, decimal_point); @@ -2474,7 +2473,7 @@ FMT_CONSTEXPR20 auto do_write_float(OutputIt out, const DecimalFP& f, auto grouping = Grouping(loc, fspecs.locale); size += to_unsigned(grouping.count_separators(exp)); return write_padded(out, specs, size, [&](iterator it) { - if (sign) *it++ = detail::sign(sign); + if (fspecs.sign) *it++ = detail::sign(fspecs.sign); it = write_significand(it, significand, significand_size, f.exponent, grouping); if (!fspecs.showpoint) return it; @@ -2488,7 +2487,7 @@ FMT_CONSTEXPR20 auto do_write_float(OutputIt out, const DecimalFP& f, auto grouping = Grouping(loc, fspecs.locale); size += to_unsigned(grouping.count_separators(significand_size)); return write_padded(out, specs, size, [&](iterator it) { - if (sign) *it++ = detail::sign(sign); + if (fspecs.sign) *it++ = detail::sign(fspecs.sign); it = write_significand(it, significand, significand_size, exp, decimal_point, grouping); return num_zeros > 0 ? detail::fill_n(it, num_zeros, zero) : it; @@ -2503,7 +2502,7 @@ FMT_CONSTEXPR20 auto do_write_float(OutputIt out, const DecimalFP& f, bool pointy = num_zeros != 0 || significand_size != 0 || fspecs.showpoint; size += 1 + (pointy ? 1 : 0) + to_unsigned(num_zeros); return write_padded(out, specs, size, [&](iterator it) { - if (sign) *it++ = detail::sign(sign); + if (fspecs.sign) *it++ = detail::sign(fspecs.sign); *it++ = zero; if (!pointy) return it; *it++ = decimal_point;