Boost logo

Boost :

Subject: Re: [boost] [function] Placement new warnings from gcc 6
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2016-04-04 03:52:45


On 2016-04-04 04:35, Gavin Lambert wrote:
> On 3/04/2016 02:08, Andrey Semashev wrote:
>> I guess, I could extract all members other than 'data' to a separate
>> union and then:
>>
>> union function_buffer
>> {
>> mutable function_buffer_members m;
>> mutable char data[sizeof(function_buffer_members)];
>> };
>>
>> This would require more modifications to the code though.
>>
>> (Sigh... if only we could inherit unions...)
>
> Could you do this with an anonymous union? eg:
>
> union function_buffer
> {
> mutable union function_buffer_members
> {
> ...
> };
> mutable char data[sizeof(function_buffer_members)];
> };
>
> Haven't tested this; not sure if it's legal to get the sizeof a subtype
> nested in the same scope like this, but it at least seems plausible.

That is a named union in your example. And if it's anonymous then you
have no name to apply sizeof to.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk