[libcxx-commits] [libcxx] [libc++] Remove _LIBCPP_COMPRESSED_PAIR from packaged_task (PR #200642)

via libcxx-commits libcxx-commits at lists.llvm.org
Sun May 31 10:46:55 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/200642.diff


2 Files Affected:

- (modified) libcxx/include/__configuration/attributes.h (+2) 
- (modified) libcxx/include/future (+6-5) 


``````````diff
diff --git a/libcxx/include/__configuration/attributes.h b/libcxx/include/__configuration/attributes.h
index cc828466482fd..71ab098e20744 100644
--- a/libcxx/include/__configuration/attributes.h
+++ b/libcxx/include/__configuration/attributes.h
@@ -215,6 +215,8 @@
 #endif
 #define _LIBCPP_HIDE_FROM_ABI_VIRTUAL _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
 
+#define _LIBCPP_HIDE_STRUCT_FROM_ABI [[__gnu__::__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE))]]
+
 // Optional attributes
 // -------------------
 
diff --git a/libcxx/include/future b/libcxx/include/future
index 9c71dfb89087d..3d2d010eebdda 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -379,7 +379,6 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
 #    include <__memory/allocator_arg_t.h>
 #    include <__memory/allocator_destructor.h>
 #    include <__memory/allocator_traits.h>
-#    include <__memory/compressed_pair.h>
 #    include <__memory/pointer_traits.h>
 #    include <__memory/shared_count.h>
 #    include <__memory/unique_ptr.h>
@@ -1413,8 +1412,10 @@ template <class _FD, class _Alloc, class _FB>
 class __packaged_task_func;
 
 template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
-class __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)> : public __packaged_task_base<_Rp(_ArgTypes...)> {
-  _LIBCPP_COMPRESSED_PAIR(_Fp, __func_, _Alloc, __alloc_);
+class _LIBCPP_HIDE_STRUCT_FROM_ABI
+    __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)> : public __packaged_task_base<_Rp(_ArgTypes...)> {
+  _LIBCPP_NO_UNIQUE_ADDRESS _Fp __func_;
+  _LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_;
 
 public:
   _LIBCPP_HIDE_FROM_ABI explicit __packaged_task_func(const _Fp& __f) : __func_(__f) {}
@@ -1435,8 +1436,8 @@ void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to(
 
 template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
 void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy() {
-  __func_.~_Fp();
   __alloc_.~_Alloc();
+  __func_.~_Fp();
 }
 
 template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
@@ -1445,8 +1446,8 @@ void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate()
   typedef allocator_traits<_Ap> _ATraits;
   typedef pointer_traits<typename _ATraits::pointer> _PTraits;
   _Ap __a(__alloc_);
-  __func_.~_Fp();
   __alloc_.~_Alloc();
+  __func_.~_Fp();
   __a.deallocate(_PTraits::pointer_to(*this), 1);
 }
 

``````````

</details>


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


More information about the libcxx-commits mailing list