[cfe-dev] http://llvm.org/bugs/show_bug.cgi?id=11462

Jeffrey Yasskin jyasskin at googlers.com
Fri Dec 2 13:48:05 PST 2011


On Fri, Dec 2, 2011 at 1:21 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
> On Fri, Dec 2, 2011 at 1:04 PM, Jeffrey Yasskin <jyasskin at googlers.com> wrote:
>> FWIW, I think a better solution for the library issue would be for
>> clang to provide an attribute saying "ignore the rule in
>> [intro.object]p6, and allow this member to have 0 size." Doing this
>> would allow possibly-empty types to be used directly as members,
>> rather than obfuscating the code by forcing them into base classes or
>> tuples. Perhaps spell the attribute [[may_be_empty]] or
>> [[may_have_same_address_as_other_members]].
>
> If we did that, the user could observe two final objects with the same
> address... which shouldn't be possible, I think.

Is that more important for final objects than other kinds of objects?
Arguably, even the attribute shouldn't be enough to put two objects of
the same type at the same address, which is the restriction used for
base classes.



More information about the cfe-dev mailing list