[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 19:17:16 PDT 2023


jiixyj wrote:

Some questions / notes:

- I zero initialize the new padding arrays (otherwise the compiler generated copy constructors would be UB I guess?). The bytes in those arrays might get overwritten by subsequent constructor/destructor calls in methods like `emplace()` but this should be OK.
- Is there an easier way to calculate the required padding bytes?
- The test(s) that assert `sizeof(expected) == datasizeof(expected)` should probably live in new files, maybe called `test/std/utilities/expected/expected.expected/datasize.pass.cpp` and `expected.void/datasize.pass.cpp`?

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


More information about the libcxx-commits mailing list