[libcxx-commits] [libcxx] [libc++] Fix ABI break introduced by switching to _LIBCPP_COMPRESSED_PAIR (PR #154686)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 21 08:14:20 PDT 2025


================
@@ -81,20 +81,24 @@ template <class _ToPad>
 class __compressed_pair_padding<_ToPad, true> {};
 
 #  define _LIBCPP_COMPRESSED_PAIR(T1, Initializer1, T2, Initializer2)                                                  \
-    _LIBCPP_NO_UNIQUE_ADDRESS __attribute__((__aligned__(::std::__compressed_pair_alignment<T2>))) T1 Initializer1;    \
-    _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T1> _LIBCPP_CONCAT3(__padding1_, __LINE__, _);          \
-    _LIBCPP_NO_UNIQUE_ADDRESS T2 Initializer2;                                                                         \
-    _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T2> _LIBCPP_CONCAT3(__padding2_, __LINE__, _)
+    struct {                                                                                                           \
+      _LIBCPP_NO_UNIQUE_ADDRESS __attribute__((__aligned__(::std::__compressed_pair_alignment<T2>))) T1 Initializer1;  \
----------------
ldionne wrote:

I don't think the attribute is needed anymore now that we have a struct enclosing it. However, I wouldn't make that change now, I would do it in a followup patch since that wouldn't be an ABI change, just a simplification.

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


More information about the libcxx-commits mailing list