forked from boostorg/function
Merge pull request #16 from joakimtosteberg/fix-aliasing-issue
Use char type directly to avoid invalid aliasing in one more place
This commit is contained in:
@ -904,7 +904,9 @@ namespace boost {
|
|||||||
if (!f.empty()) {
|
if (!f.empty()) {
|
||||||
this->vtable = f.vtable;
|
this->vtable = f.vtable;
|
||||||
if (this->has_trivial_copy_and_destroy())
|
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(boost::detail::function::function_buffer));
|
||||||
else
|
else
|
||||||
get_vtable()->base.manager(f.functor, this->functor,
|
get_vtable()->base.manager(f.functor, this->functor,
|
||||||
boost::detail::function::clone_functor_tag);
|
boost::detail::function::clone_functor_tag);
|
||||||
|
Reference in New Issue
Block a user