[PATCH] D98477: [ADT] Add IntrusiveVariant, VariantTraits, and new STLForwardCompat
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 28 11:26:46 PDT 2021
dblaikie added a comment.
In D98477#2783276 <https://reviews.llvm.org/D98477#2783276>, @scott.linder wrote:
> In D98477#2780702 <https://reviews.llvm.org/D98477#2780702>, @dblaikie wrote:
>
>> Side thought: If this is going to use a prefix for the discriminator - could that be a base class that all types being used as union members have to derive from? No need for a macro, etc. Could use an offsetof comparison to make sure that not only is it a base class, but the first non-empty base class.
>>
>> (still haven't been able to easily apply this locally - looks like it hit a conflict with c6f20d70a8c93ab3d50c9777c477fe040460a664 <https://reviews.llvm.org/rGc6f20d70a8c93ab3d50c9777c477fe040460a664> - though I thought arc would sync to the right version to apply the patch... not sure what's going on - might just wait to try that until the other patches have been committed)
>
> Unfortunately having any non-static data members as part of a base class will make the alternative types non-standard-layout, which means we can't use the "common initial sequence" rule to pack them.
But would we need to use the common initial sequence rule? If the base object was at the start of the layout - a pointer to the start of the layout would be a valid pointer to the base object, yeah?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98477/new/
https://reviews.llvm.org/D98477
More information about the llvm-commits
mailing list