From f5556225a4df3d8567334135e50706cec51a826c Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Tue, 27 Aug 2019 12:46:05 -0600 Subject: [PATCH] Eliminate shadow variable warning gcc-9 gives the following shadow warning: ``` In file included from /Users/libraries/ioss/src/fmt/ostream.h:12, from /Users/libraries/ioss/src/Ioss_DatabaseIO.C:59: /Users/libraries/ioss/src/fmt/format.h: In function 'void fmt::v6::internal::parse_format_string(fmt::v6::basic_string_view, Handler&&)': /Users/libraries/ioss/src/fmt/format.h:2442:10: warning: declaration of 'struct fmt::v6::internal::parse_format_string(fmt::v6::basic_string_view, Handler&&)::writer' shadows a global declaration [-Wshadow] 2442 | struct writer { | ^~~~~~ /Users/libraries/ioss/src/fmt/format.h:1703:7: note: shadowed declaration is here 1703 | using writer = basic_writer>; | ^~~~~~ ``` Since the `writer` struct is only used internally in the `parse_format_string` function, its name can be changed somewhat aribtrarily to avoid conflicts with names in an outer scope. Note that this warning is also present in the 6.0.0 release. --- 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 efec5d6d..5d6be744 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2439,7 +2439,7 @@ template struct id_adapter { template FMT_CONSTEXPR void parse_format_string(basic_string_view format_str, Handler&& handler) { - struct writer { + struct pfs_writer { FMT_CONSTEXPR void operator()(const Char* begin, const Char* end) { if (begin == end) return; for (;;) {