Boost logo

Boost :

Subject: Re: [boost] [function] Placement new warnings from gcc 6
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2016-04-05 00:12:09

On 2016-04-05 06:39, Gavin Lambert wrote:
> On 4/04/2016 19:52, Andrey Semashev wrote:
>> On 2016-04-04 04:35, Gavin Lambert wrote:
>>> 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.
> Type name != member name. It is still an anonymous union.

It is not. My reading of the above code snippet is that there is a
nested function_buffer_members union type definition. There is no member
of that type in function_buffer, and since it is not an anonymous union,
its members are not "inlined" into the containing scope (i.e. the
function_buffer union). The mutable keyword is illegal in that context.

Boost list run by bdawes at, gregod at, cpdaniel at, john at