git: 035396ceda49 - main - libcxx-compat: revert llvmorg-21-init-10154-ge43e8ec7afbd:
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 25 Apr 2026 14:20:11 UTC
The branch main has been updated by dim:
URL: https://cgit.FreeBSD.org/src/commit/?id=035396ceda495f456ca570fb715b04a7fc3b25c2
commit 035396ceda495f456ca570fb715b04a7fc3b25c2
Author: Dimitry Andric <dimitry@andric.com>
AuthorDate: 2026-01-05 19:55:12 +0000
Commit: Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2026-04-25 14:14:20 +0000
libcxx-compat: revert llvmorg-21-init-10154-ge43e8ec7afbd:
[libc++] Remove dead implementation of is_nothrow_convertible and merge the remaining code into is_convertible.h (#137717)
We can use the `__is_nothrow_convertible` builtin unconditionally now,
which makes the implementation very simple, so there isn't much of a
need to keep a separate header around.
This is part of making libc++ 21 build with clang 18.
PR: 292067
MFC after: 1 month
---
.../libcxx/include/__type_traits/is_convertible.h | 26 ++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/contrib/llvm-project/libcxx/include/__type_traits/is_convertible.h b/contrib/llvm-project/libcxx/include/__type_traits/is_convertible.h
index f0a859f9cc16..56f26ffaec71 100644
--- a/contrib/llvm-project/libcxx/include/__type_traits/is_convertible.h
+++ b/contrib/llvm-project/libcxx/include/__type_traits/is_convertible.h
@@ -10,6 +10,9 @@
#define _LIBCPP___TYPE_TRAITS_IS_CONVERTIBLE_H
#include <__config>
+#include <__type_traits/conjunction.h>
+#include <__type_traits/disjunction.h>
+#include <__type_traits/lazy.h>
#include <__type_traits/integral_constant.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -28,12 +31,35 @@ _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_convertible_v = __is_convert
#if _LIBCPP_STD_VER >= 20
+# if __has_builtin(__is_nothrow_convertible)
+
template <class _Tp, class _Up>
struct _LIBCPP_NO_SPECIALIZATIONS is_nothrow_convertible : bool_constant<__is_nothrow_convertible(_Tp, _Up)> {};
template <class _Tp, class _Up>
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_convertible_v = __is_nothrow_convertible(_Tp, _Up);
+# else // __has_builtin(__is_nothrow_convertible)
+
+template <typename _Tp>
+void __test_noexcept(_Tp) noexcept;
+
+template <typename _Fm, typename _To>
+bool_constant<noexcept(std::__test_noexcept<_To>(std::declval<_Fm>()))> __is_nothrow_convertible_test();
+
+template <typename _Fm, typename _To>
+struct __is_nothrow_convertible_helper : decltype(std::__is_nothrow_convertible_test<_Fm, _To>()) {};
+
+template <typename _Fm, typename _To>
+struct is_nothrow_convertible
+ : _Or<_And<is_void<_To>, is_void<_Fm>>,
+ _Lazy<_And, is_convertible<_Fm, _To>, __is_nothrow_convertible_helper<_Fm, _To> > >::type {};
+
+template <typename _Fm, typename _To>
+inline constexpr bool is_nothrow_convertible_v = is_nothrow_convertible<_Fm, _To>::value;
+
+# endif // __has_builtin(__is_nothrow_convertible)
+
#endif // _LIBCPP_STD_VER >= 20
_LIBCPP_END_NAMESPACE_STD