Skip to content

Commit

Permalink
Suppress a bogus warning
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Jul 28, 2022
1 parent 81f1cc7 commit e9ca7ea
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@ FMT_CONSTEXPR20 auto bit_cast(const From& from) -> To {
if (is_constant_evaluated()) return std::bit_cast<To>(from);
#endif
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;
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e9ca7ea

Please sign in to comment.