dblaikie added a comment.

> So I could test this other ways that actually impact layout - like whether 
> things can be packed in tail padding (can pack in tail padding for non-pod, 
> right?). Or we could ast dump and inspect the property directly? Maybe there 
> are some other options?

Here's what the tail-padding based testing looks like: 
https://godbolt.org/z/Te3d4fYjj (though the asserts all fail on MSVC... not 
sure what size MSVC makes these structs at all)

  namespace trailing {
  struct t1 {
      int x;
      char c;
  };
  struct t2 : t1 {
      char c;  
  };
  static_assert(sizeof(t2) == sizeof(int) * 3, "");
  } // namespace trailing
  namespace trailing_nonpod {
  struct t1 {
  protected:
      int x;
      char c;
  };
  struct t2 : t1  {
      char c;
  };
  static_assert(sizeof(t2) == sizeof(int) * 2, "");
  }  // namespace trailing_nonpod
  namespace trailing_smf_defaulted_pod {
  struct t1 {
      t1() = default;
      int a;
      char c;
  };
  struct t2 : t1 {
      char c;
  };
  static_assert(sizeof(t2) == sizeof(int) * 3, "");
  }

(GCC passes all these assertions, Clang (without this patch we're reviewing) 
fails the last of them)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119051

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

Reply via email to