Boost logo

Boost :

Subject: Re: [boost] [function] Placement new warnings from gcc 6
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2016-04-04 23:45:34


Mere moments ago, quoth I:
> 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.

Although on further reflection, allowing a tag name on an anonymous
union might be a Microsoft-specific extension (though GCC can enable
support for it via command-line parameter).

It's probably something that *ought* to be in the standard, but that
probably doesn't help you much at this time.


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