From 54014e42e3fa3079be52792427eb9357c852ffb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Ljungstr=C3=B6m?= Date: Fri, 2 Jul 2021 22:51:49 +0200 Subject: [PATCH] silence warning C4100 on MSVC 2019 when exceptions are disabled (#2397) --- include/fmt/core.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 2545137c..caf9904c 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -337,7 +337,7 @@ struct monostate { // `(void)var` method does not work on many intel compilers. This is // from Herb Sutter, "Shutting up compiler warnings", // https://herbsutter.com/2009/10/18/mailbag-shutting-up-compiler-warnings/ -template void ignore_unused(const T&) {} +template FMT_CONSTEXPR void ignore_unused(const Ts&...) {} // An enable_if helper to be used in template parameters which results in much // shorter symbols: https://godbolt.org/z/sWw4vP. Extra parentheses are needed @@ -367,7 +367,8 @@ FMT_NORETURN FMT_API void assert_fail(const char* file, int line, #ifndef FMT_ASSERT # ifdef NDEBUG // FMT_ASSERT is not empty to avoid -Werror=empty-body. -# define FMT_ASSERT(condition, message) ((void)0) +# define FMT_ASSERT(condition, message) \ + ::fmt::ignore_unused((condition), (message)) # else # define FMT_ASSERT(condition, message) \ ((condition) /* void() fails with -Winvalid-constexpr on clang 4.0.1 */ \