use char type directly to avoid invalid aliasing

This commit is contained in:
Piotr Podusowski
2018-03-16 11:47:23 +01:00
parent bd9c06bd37
commit 0ee8e59d0a

View File

@ -992,7 +992,9 @@ namespace boost {
if (!f.empty()) {
this->vtable = f.vtable;
if (this->has_trivial_copy_and_destroy())
this->functor = f.functor;
// Don't operate on storage directly since union type doesn't relax
// strict aliasing rules, despite of having member char type.
std::memcpy(this->functor.data, f.functor.data, sizeof(this->functor.data));
else
get_vtable()->base.manager(f.functor, this->functor,
boost::detail::function::move_functor_tag);