Skip to content
forked from fmtlib/fmt

Commit

Permalink
Fix conflict with std::ignore (fmtlib#4356)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dinomight authored Feb 20, 2025
1 parent 251320f commit 7f76955
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/fmt/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -2729,9 +2729,9 @@ template <typename... T> struct fstring {
std::is_same<typename S::char_type, char>::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) {}

Expand Down

0 comments on commit 7f76955

Please sign in to comment.