Suppress a bogus warning

This commit is contained in:
Victor Zverovich 2022-07-28 07:12:49 -07:00
parent 81f1cc74a7
commit e9ca7ea472

View File

@ -287,7 +287,8 @@ FMT_CONSTEXPR20 auto bit_cast(const From& from) -> To {
if (is_constant_evaluated()) return std::bit_cast<To>(from); if (is_constant_evaluated()) return std::bit_cast<To>(from);
#endif #endif
auto to = To(); auto to = To();
std::memcpy(&to, &from, sizeof(to)); // The cast suppresses a bogus -Wclass-memaccess on GCC.
std::memcpy(static_cast<void*>(&to), &from, sizeof(to));
return to; return to;
} }
@ -925,7 +926,7 @@ namespace detail {
FMT_API bool write_console(std::FILE* f, string_view text); FMT_API bool write_console(std::FILE* f, string_view text);
#endif #endif
FMT_API void print(std::FILE*, string_view); FMT_API void print(std::FILE*, string_view);
} } // namespace detail
/** A formatting error such as invalid format string. */ /** A formatting error such as invalid format string. */
FMT_CLASS_API FMT_CLASS_API