Suggestion: class/struct tuples preserve anonymous unions/structs
Sean Kelly
sean at f4.ca
Thu Feb 15 13:28:23 PST 2007
Frits van Bommel wrote:
> Walter Bright wrote:
>> Jarrett Billingsley wrote:
>>> I'm not sure how anonymous unions and structs are handled by the
>>> compiler.
>>
>> This has nothing to do with tuples. Anonymous structs and unions are
>> used for layout only, the members are 'promoted' into the enclosing
>> aggregate.
>
> It's fairly obvious this is what's happening. And normally this wouldn't
> matter as you wouldn't be able see the difference, but because of
> ..tupleof this is now detectable.
> I think the real question here is: while this may be what *is*
> happening, is this also what *should* happen? (i.e. "Is this a bug?")
> I can't find anything specifying this behavior in the spec...
I think as long as .offsetof can be obtained for the values then
everything should be fine. You know members are part of a union when
their .offsetof is the same.
Sean
More information about the Digitalmars-d
mailing list