[libcxx-commits] [libcxx] [libc++] Remove alignment attributes from _LIBCPP_COMPRESSED_PAIR (PR #158595)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Sep 23 07:42:06 PDT 2025


================
@@ -100,18 +100,15 @@ class __compressed_pair_padding<_ToPad, true> {};
 #  else
 #    define _LIBCPP_COMPRESSED_PAIR(T1, Initializer1, T2, Initializer2)                                                \
       struct {                                                                                                         \
-        _LIBCPP_NO_UNIQUE_ADDRESS                                                                                      \
-        __attribute__((__aligned__(::std::__compressed_pair_alignment<T2>))) T1 Initializer1;                          \
+        _LIBCPP_NO_UNIQUE_ADDRESS T1 Initializer1;                                                                     \
----------------
ldionne wrote:

We have this comment above:

```
// The first member is aligned to the alignment of the second member to force padding in front of the compressed pair
// in case there are members before it.
```

This is only true for GCC now. Maybe say `On GCC, the first member is aligned <blablabla>. On Clang, this is unnecessary because <blablabla>.`


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


More information about the libcxx-commits mailing list