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

Jan Kokemüller via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 21 04:56:26 PDT 2023


================
@@ -909,11 +850,19 @@ class expected {
         std::__expected_construct_unexpected_from_invoke_tag, _Func&& __f, _Args&&... __args)
         : __unex_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {}
 
+    template <class _Union>
+    _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(bool __has_val, _Union&& __other) {
----------------
jiixyj wrote:

Hm, then the union would need to be default constructible and have an `__empty_` member again. Also, ordering issues among the union and `__has_val_` flag initialization would become possible once more. What do you think?

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


More information about the llvm-commits mailing list