[libcxx-commits] [libcxx] [libc++] Add alias template for __strip_signature::type (PR #181955)
William Fynn via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Feb 17 20:28:53 PST 2026
https://github.com/fynnwilliam updated https://github.com/llvm/llvm-project/pull/181955
>From 884b029bf0814c6c822946d8093374fe9b70308f Mon Sep 17 00:00:00 2001
From: fynnwilliam <fynnwilliam at gmail.com>
Date: Wed, 18 Feb 2026 02:07:05 +0000
Subject: [PATCH 1/2] [libc++] Add alias template for __strip_signature::type
This simplifies the internal implementation by providing a more concise
way to access the underlying type within the __strip_signature class.
---
libcxx/include/__functional/function.h | 2 +-
libcxx/include/__type_traits/strip_signature.h | 3 +++
libcxx/include/future | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h
index c1675879ec19f..d3a978ac862db 100644
--- a/libcxx/include/__functional/function.h
+++ b/libcxx/include/__functional/function.h
@@ -684,7 +684,7 @@ class function<_Rp(_ArgTypes...)>
template <class _Rp, class... _Ap>
function(_Rp (*)(_Ap...)) -> function<_Rp(_Ap...)>;
-template <class _Fp, class _Stripped = typename __strip_signature<decltype(&_Fp::operator())>::type>
+template <class _Fp, class _Stripped = __strip_signature_t<decltype(&_Fp::operator())>>
function(_Fp) -> function<_Stripped>;
# endif // _LIBCPP_STD_VER >= 17
diff --git a/libcxx/include/__type_traits/strip_signature.h b/libcxx/include/__type_traits/strip_signature.h
index c8b33278737ed..a0c915936d4d4 100644
--- a/libcxx/include/__type_traits/strip_signature.h
+++ b/libcxx/include/__type_traits/strip_signature.h
@@ -74,6 +74,9 @@ template<class _Rp, class _Gp, class ..._Ap>
struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile & noexcept> { using type _LIBCPP_NODEBUG = _Rp(_Ap...); };
// clang-format on
+template <class _Fp>
+using __strip_signature_t _LIBCPP_NODEBUG = __strip_signature<_Fp>::type;
+
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_STD_VER >= 17
diff --git a/libcxx/include/future b/libcxx/include/future
index 4084148e52af6..6bd836afa04e8 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -1749,7 +1749,7 @@ public:
template <class _Rp, class... _Args>
packaged_task(_Rp (*)(_Args...)) -> packaged_task<_Rp(_Args...)>;
-template <class _Fp, class _Stripped = typename __strip_signature<decltype(&_Fp::operator())>::type>
+template <class _Fp, class _Stripped = __strip_signature_t<decltype(&_Fp::operator())>>
packaged_task(_Fp) -> packaged_task<_Stripped>;
# endif
>From 645c2002b6d6e546277fff9cb5f1f098c4a68d8d Mon Sep 17 00:00:00 2001
From: fynnwilliam <fynnwilliam at gmail.com>
Date: Wed, 18 Feb 2026 04:13:04 +0000
Subject: [PATCH 2/2] [libc++] Refactor __strip_signature_t for portability
Follow-up to the previous commit to ensure full compatibility
with the libc++ coding standards and to resolve linker/compiler
issues observed on AIX (32-bits) build bots.
---
libcxx/include/__type_traits/strip_signature.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libcxx/include/__type_traits/strip_signature.h b/libcxx/include/__type_traits/strip_signature.h
index a0c915936d4d4..1ff5b3d9ec620 100644
--- a/libcxx/include/__type_traits/strip_signature.h
+++ b/libcxx/include/__type_traits/strip_signature.h
@@ -75,7 +75,7 @@ struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile & noexcept> { usin
// clang-format on
template <class _Fp>
-using __strip_signature_t _LIBCPP_NODEBUG = __strip_signature<_Fp>::type;
+using __strip_signature_t _LIBCPP_NODEBUG = typename __strip_signature<_Fp>::type;
_LIBCPP_END_NAMESPACE_STD
More information about the libcxx-commits
mailing list