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*.
This commit is contained in:
Kesavan Yogeswaran authored and Behdad Esfahbod committed 2024-12-02 14:55:50 -07:00
1 parent 10cf348a67
commit 1c249be96e
1 file changed
+1 -1
+1 -1
View File
@@ -176,7 +176,7 @@ template <typename Type>
static inline Type& Crap () {
static_assert (hb_null_size (Type) <= HB_NULL_POOL_SIZE, "Increase HB_NULL_POOL_SIZE.");
Type *obj = reinterpret_cast<Type *> (_hb_CrapPool);
memcpy (obj, std::addressof (Null (Type)), sizeof (*obj));
memcpy (reinterpret_cast<void*>(obj), std::addressof (Null (Type)), sizeof (*obj));
return *obj;
}
template <typename QType>