aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dimitry@andric.com>2026-01-05 19:54:32 +0000
committerDimitry Andric <dim@FreeBSD.org>2026-05-29 22:59:36 +0000
commita2694ead3368361edfa0c45e1b7e7a9d5a097583 (patch)
treebc425d8bf38fbf019626f2ad88880264e54d9435
parentc350cdf7c80c4e5cba60ac7c5c1a9207abea005e (diff)
libcxx-compat: revert llvmorg-19-init-5639-ga10aa4485e83:
[libc++] Simplify the implementation of remove_reference (#85207) GCC 13 introduced the type trait `__remove_reference`. We can simplify the implementation of `remove_reference` a bit by using it. This is part of making libc++ 21 build with clang 18. PR: 292067 MFC after: 1 month (cherry picked from commit a114ece3e6158f49088b0704b4afef07040d83f3)
-rw-r--r--contrib/llvm-project/libcxx/include/__type_traits/remove_reference.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/contrib/llvm-project/libcxx/include/__type_traits/remove_reference.h b/contrib/llvm-project/libcxx/include/__type_traits/remove_reference.h
index 7cc3ca1705de..f7522fa1a67d 100644
--- a/contrib/llvm-project/libcxx/include/__type_traits/remove_reference.h
+++ b/contrib/llvm-project/libcxx/include/__type_traits/remove_reference.h
@@ -34,7 +34,14 @@ struct remove_reference {
template <class _Tp>
using __libcpp_remove_reference_t = typename remove_reference<_Tp>::type;
#else
-# error "remove_reference not implemented!"
+// clang-format off
+template <class _Tp> struct remove_reference {using type _LIBCPP_NODEBUG = _Tp;};
+template <class _Tp> struct remove_reference<_Tp&> {using type _LIBCPP_NODEBUG = _Tp;};
+template <class _Tp> struct remove_reference<_Tp&&> {using type _LIBCPP_NODEBUG = _Tp;};
+// clang-format on
+
+template <class _Tp>
+using __libcpp_remove_reference_t = typename remove_reference<_Tp>::type;
#endif // __has_builtin(__remove_reference_t)
#if _LIBCPP_STD_VER >= 14