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*.
pull/4964/head
Kesavan Yogeswaran 3 months ago committed by Behdad Esfahbod
parent 10cf348a67
commit 1c249be96e
  1. 2
      src/hb-null.hh

@ -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>

Loading…
Cancel
Save