$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-users] function_base.hpp type-punned pointer warnings
From: KSpam (keesling_spam_at_[hidden])
Date: 2011-03-10 11:25:18
I get a ton of warnings (well over 5000 in the code base I am compiling) from
function_base.hpp when compiling with gcc.
boost-1.46.0/include/boost/function/function_base.hpp:321: warning:
dereferencing type-punned pointer will break strict-aliasing rules
boost-1.46.0/include/boost/function/function_base.hpp:325: warning:
dereferencing type-punned pointer will break strict-aliasing rules
This has been a known problem for a very long time, and the work around is
quite simple. Replace
reinterpret_cast<functor_type*>(&in_buffer.data)->~Functor();
with
functor_type* p = reinterpret_cast<functor_type*>(&in_buffer.data);
p->~Functor();
and replace
reinterpret_cast<functor_type*>(&out_buffer.data)->~Functor();
with
functor_type* p = reinterpret_cast<functor_type*>(&out_buffer.data);
p->~Functor();
Would it be a reasonable request to have this simple patch applied to the
boost source code?
Respectfully,
Justin