dexonsmith added a comment.

In D69471#1883912 <https://reviews.llvm.org/D69471#1883912>, @rnk wrote:

> Everything is off-by-one because the empty bases are not zero sized. The MSVC 
> record layout algorithm is just different in this area. =/


Do all the MSVCs we support building with support `__declspec(empty_bases)`?
https://devblogs.microsoft.com/cppblog/optimizing-the-layout-of-empty-base-classes-in-vs2015-update-2-3/

> So, I think this patch would be fine if you refactor it to avoid the accessor 
> classes. I took a stab at it, but it's not straightforward.

Another option is to chain the accessor classes:

  template <class T, class Base = void> struct MyAccessor1 : Base { /* ... */ };
  template <class T> struct MyAccessor1<void> { /* ... */ };
  template <class T, class Base = void> struct MyAccessor2 : Base { /* ... */ };
  template <class T> struct MyAccessor2<void> { /* ... */ };

Then you can:

  struct MyFormat : MyAccessor1<MyFormat, MyAccessor2<MyFormat>> { /* ... */ };


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69471/new/

https://reviews.llvm.org/D69471



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to