[libcxx-commits] [PATCH] D146190: Fix EBO on std::optional and std::variant when targeting the MSVC ABI
David Benjamin via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Mar 15 20:54:37 PDT 2023
davidben created this revision.
davidben added reviewers: jdoerrie, ldionne.
Herald added subscribers: mstorsjo, arphaman.
Herald added a project: All.
davidben requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Patch originally by Jan Dörrie in https://reviews.llvm.org/D120064. I've just updated it to include tests, and update documentation that MSVC ABI is not stable.
In the current implementation both `std::optional` and `std::variant` don't perform the EBO on MSVC's ABI. This is because both classes inherit from multiple empty base classes, which breaks the EBO for MSVC. This patch fixes this issue by applying the `empty_bases` declspec attribute, which is already used to fix a similar issue for `std::tuple`.
Fixes https://github.com/llvm/llvm-project/issues/61095.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D146190
Files:
libcxx/docs/index.rst
libcxx/include/optional
libcxx/include/variant
libcxx/test/libcxx/utilities/optional/optional.object/optional_size.pass.cpp
libcxx/test/libcxx/utilities/variant/variant.variant/variant_size.pass.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146190.505695.patch
Type: text/x-patch
Size: 4489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230316/f198001d/attachment-0001.bin>
More information about the libcxx-commits
mailing list