From 7f7695524a4bc3c9b7883afcc86ba61421989b7f Mon Sep 17 00:00:00 2001 From: Dean Date: Thu, 20 Feb 2025 00:08:21 -0700 Subject: [PATCH] Fix conflict with std::ignore (#4356) In situations where `using namespace std;` is used, compiler warnings can be generated because of local variables named `ignore`. This renames those variables to something else to address the name conflict. --- include/fmt/base.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/fmt/base.h b/include/fmt/base.h index ce71ad98..a37858a8 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -294,8 +294,8 @@ #endif #define FMT_APPLY_VARIADIC(expr) \ - using ignore = int[]; \ - (void)ignore { 0, (expr, 0)... } + using unused = int[]; \ + (void)unused { 0, (expr, 0)... } // Enable minimal optimizations for more compact code in debug mode. FMT_PRAGMA_GCC(push_options) @@ -2729,9 +2729,9 @@ template struct fstring { std::is_same::value)> FMT_ALWAYS_INLINE fstring(const S&) : str(S()) { FMT_CONSTEXPR auto sv = string_view(S()); - FMT_CONSTEXPR int ignore = + FMT_CONSTEXPR int unused = (parse_format_string(sv, checker(sv, arg_pack())), 0); - detail::ignore_unused(ignore); + detail::ignore_unused(unused); } fstring(runtime_format_string<> fmt) : str(fmt.str) {}