[libcxx-commits] [libcxx] [libc++] Ensure that `std::expected` has no tail padding (PR #69673)

Jan Kokemüller via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 19 23:02:52 PDT 2023


jiixyj wrote:

> Does an unnamed bit-field work?

It looks like it does!

```c++
struct s3 {
    s3() : bp_{}, b_{} {};

   private:
    [[no_unique_address]] bp bp_;
    bool b_;
    int : 0;
};
static_assert(sizeof(s3) == 4);
static_assert(std::__libcpp_datasizeof<s3>::value == 4);  // good :)
```

https://github.com/llvm/llvm-project/pull/69673


More information about the libcxx-commits mailing list