From 1c249be96e27eafd15eb86d832b67fbc3751634b Mon Sep 17 00:00:00 2001 From: Kesavan Yogeswaran Date: Mon, 2 Dec 2024 15:51:19 +0000 Subject: [PATCH] Sidestep nontrivial-memaccess warning in Crap() With -Wnontrivial-memaccess, recent versions of clang flag the usage of memcpy in hb-null.hh with pointers to nontrivially-copyable types. Sidestep this warning by casting the problematic pointer to void*. --- src/hb-null.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-null.hh b/src/hb-null.hh index 854485d3d..3588f6ab2 100644 --- a/src/hb-null.hh +++ b/src/hb-null.hh @@ -176,7 +176,7 @@ template static inline Type& Crap () { static_assert (hb_null_size (Type) <= HB_NULL_POOL_SIZE, "Increase HB_NULL_POOL_SIZE."); Type *obj = reinterpret_cast (_hb_CrapPool); - memcpy (obj, std::addressof (Null (Type)), sizeof (*obj)); + memcpy (reinterpret_cast(obj), std::addressof (Null (Type)), sizeof (*obj)); return *obj; } template