From 5d7366e37beeec0053791acb7f878fd55911a1bb Mon Sep 17 00:00:00 2001 From: Federico Busato Date: Tue, 5 Jul 2022 16:04:13 -0700 Subject: [PATCH] copying an object of non-trivial type error --- include/fmt/format.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 0bd2fdb1..34da562f 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)); + std::memcpy(static_cast(&to), static_cast(&from), + sizeof(to)); return to; }