[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:38 PDT 2023


================
@@ -955,8 +956,17 @@ class expected {
     _LIBCPP_NO_UNIQUE_ADDRESS _ErrorType __unex_;
   };
 
+  _LIBCPP_HIDE_FROM_ABI static constexpr auto __calculate_padding() {
----------------
ldionne wrote:

This won't work if there is no tail padding, since we'll end up creating a `char __padding_[0];` below. This is the case for e.g. `std::expected<char, char>`. Needs tests.

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


More information about the libcxx-commits mailing list