copying an object of non-trivial type error

This commit is contained in:
Federico Busato 2022-07-05 16:04:13 -07:00
parent c4ee726532
commit 5d7366e37b

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);
#endif
auto to = To();
std::memcpy(&to, &from, sizeof(to));
std::memcpy(static_cast<void*>(&to), static_cast<const void*>(&from),
sizeof(to));
return to;
}