From 712abe40f297bf0a1bbf3479599fd4a0d10dc0d2 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 4 Oct 2020 08:36:55 -0700 Subject: [PATCH] Workaround a bug in gcc 7.5 (#1912) Thanks Martin Janzen. --- include/fmt/core.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 9f030e38..2e1ae4b6 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -910,7 +910,8 @@ template struct named_arg_info { template struct arg_data { // args_[0].named_args points to named_args_ to avoid bloating format_args. - T args_[1 + (NUM_ARGS != 0 ? NUM_ARGS : 1)]; + // +1 to workaround a bug in gcc 7.5 that causes duplicated-branches warning. + T args_[1 + (NUM_ARGS != 0 ? NUM_ARGS : +1)]; named_arg_info named_args_[NUM_NAMED_ARGS]; template @@ -922,7 +923,8 @@ struct arg_data { template struct arg_data { - T args_[NUM_ARGS != 0 ? NUM_ARGS : 1]; + // +1 to workaround a bug in gcc 7.5 that causes duplicated-branches warning. + T args_[NUM_ARGS != 0 ? NUM_ARGS : +1]; template FMT_INLINE arg_data(const U&... init) : args_{init...} {}