[PATCH] D139741: [clang][CodeGen] Use base subobject type layout for potentially-overlapping fields

Jordan Rupprecht via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 15 23:45:31 PST 2022


rupprecht added a comment.

In D139741#4000201 <https://reviews.llvm.org/D139741#4000201>, @rupprecht wrote:

> I'm not sure what the libcxx failure was that caused you to revert this, but we also saw a clang crasher as a result of this. `clang/lib/AST/Decl.cpp:4300 in unsigned int clang::FieldDecl::getBitWidthValue(const ASTContext &) const: isBitField() && "not a bitfield"`. I'll try to reduce it.

Here:

  template <class F, class X, class Y>
  struct Foo {
    Foo(F, X, Y y) : y_(y) {}
    Y y_;
    union FooHolder {
      int foo;
    };
    [[no_unique_address]] FooHolder foo_holder_;
  };
  template <typename Factory, typename X, typename Y>
  void MakeFoo(Factory f, X x, Y y) {
    Foo(f, x, y);
  }
  void Start() {
    MakeFoo(0, int(), [] {});
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139741



More information about the cfe-commits mailing list