[libcxx-commits] [libcxx] [libc++] Replace `__compressed_pair` with `[[no_unique_address]]` (PR #76756)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 18 09:59:18 PST 2024


================
@@ -299,28 +305,19 @@ struct __shared_ptr_emplace : __shared_weak_count {
   // with Allocator construction for _Tp. To allow implementing P0674 in C++20,
   // we now use a properly aligned char buffer while making sure that we maintain
   // the same layout that we had when we used a compressed pair.
-  using _CompressedPair = __compressed_pair<_Alloc, _Tp>;
-  struct _ALIGNAS_TYPE(_CompressedPair) _Storage {
-    char __blob_[sizeof(_CompressedPair)];
+  struct [[using __gnu__: __aligned__(_LIBCPP_ALIGNOF(_Alloc)), __aligned__(_LIBCPP_ALIGNOF(_Tp))]] _Storage {
----------------
ldionne wrote:

Is this alignment required? Isn't that forced by `_LIBCPP_COMPRESSED_PAIR` now?

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


More information about the libcxx-commits mailing list