Boost logo

Boost Users :

Subject: Re: [Boost-users] [Spirit] dereferencing type-punned pointer will break strict-aliasing rules
From: Roland Bock (rbock_at_[hidden])
Date: 2010-08-12 03:48:35


On 08/12/2010 08:26 AM, KSpam wrote:
> Roland,
>
> On Wednesday 11 August 2010 01:37:17 Roland Bock wrote:
>> leads to a long warning message (second attachment), culminating in
>>
>> boost/1.44/include/boost/function/function_base.hpp:321: warning:
>> dereferencing type-punned pointer will break strict-aliasing rules
>> boost/1.44/include/boost/function/function_base.hpp:325: warning:
>> dereferencing type-punned pointer will break strict-aliasing rules
>
> This warning can be prevented by splitting the line into two lines as follows:
>
> Replace:
> reinterpret_cast<functor_type*>(&in_buffer.data)->~Functor();
>
> with:
> functor_type* p = reinterpret_cast<functor_type*>(&in_buffer.data);
> p->~Functor();
>
> I patched my local version of Boost in order to prevent these warnings.
>
> Hope This Helps,
> Justin

Justin,

thanks for the hint! I'll give it a try and will probably file a ticket
if it works out :-)

Regards,

Roland


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net