[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 Sep 5 09:28:06 PDT 2024
================
@@ -91,8 +93,11 @@ LLVM 21
ABI Affecting Changes
---------------------
-- TODO
-
+- The internal structure ``__compressed_pair`` has been replaced with ``[[no_unique_address]]``. When using the Itanium
+ ABI (most non-MSVC platforms), this change results in empty final types being placed at the beginning of the enclosing
+ object instead of where the beginning of the ``__compressed_pair`` subobject was. This is only observable by checking
+ the address of the subobject. When using the MSVC ABI, this change results in some classes having a completely
+ different memory layout.
----------------
ldionne wrote:
```suggestion
- The internal structure ``__compressed_pair`` has been replaced with ``[[no_unique_address]]``. The ABI impact is:
- When using the Itanium ABI (most non-MSVC platforms), empty types are now placed at the beginning of the enclosing
object instead of where the beginning of the ``__compressed_pair`` subobject was. This is only observable by checking
the address of the empty member. This is observable in most of the standard containers when provided with an empty
allocator and/or hasher.
- Additionally, using an overaligned empty type as an allocator or hasher in the unordered containers (and only those
containers) may result in the container's object size and data layout changing beyond only the address of the empty
allocator/hasher.
- In the MSVC ABI, this change results in some classes having a completely different memory layout, so this is a
genuine ABI break. However, the library does not currently guarantee ABI stability on MSVC platforms.
```
https://github.com/llvm/llvm-project/pull/76756
More information about the libcxx-commits
mailing list