From e9ca7ea472a387639cef65a93037afcee26e4733 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Thu, 28 Jul 2022 07:12:49 -0700 Subject: [PATCH] Suppress a bogus warning --- include/fmt/format.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 3baf64a2..1de7b45e 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -287,7 +287,8 @@ FMT_CONSTEXPR20 auto bit_cast(const From& from) -> To { if (is_constant_evaluated()) return std::bit_cast(from); #endif auto to = To(); - std::memcpy(&to, &from, sizeof(to)); + // The cast suppresses a bogus -Wclass-memaccess on GCC. + std::memcpy(static_cast(&to), &from, sizeof(to)); return to; } @@ -925,7 +926,7 @@ namespace detail { FMT_API bool write_console(std::FILE* f, string_view text); #endif FMT_API void print(std::FILE*, string_view); -} +} // namespace detail /** A formatting error such as invalid format string. */ FMT_CLASS_API