From 40e414d823d8af78cf6f52f3356c4c54e02eb62f Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Mon, 29 Aug 2022 13:47:17 -0600 Subject: [PATCH] Fix compilation error with gcc-7.2.0 Without the added line, the gcc-7.2.0 compiler will give the following error: ``` /opt/compiler-explorer/libs/fmt/trunk/include/fmt/format.h:1240:8: error: uninitialized variable 'buffer' in 'constexpr' function Char buffer[digits10() + 1]; ^~~~~~ ``` See https://godbolt.org/z/fh7TMs9qs --- include/fmt/format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 7c607dbd..b2dbad04 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1238,7 +1238,7 @@ template format_decimal_result { // Buffer is large enough to hold all digits (digits10 + 1). - Char buffer[digits10() + 1]; + Char buffer[digits10() + 1] = {}; auto end = format_decimal(buffer, value, size).end; return {out, detail::copy_str_noinline(buffer, end, out)}; }