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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 20 09:43:37 PDT 2023


https://github.com/ldionne requested changes to this pull request.

> 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.

Ah, good point. Maybe worth a one-line comment somewhere since I was actually about to ask a question about that.

> 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`?

They should be in `libcxx/test/libcxx/<...>` since that is where we store our libc++ specific tests.

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


More information about the libcxx-commits mailing list