aboutsummaryrefslogtreecommitdiff
path: root/libcxx
diff options
context:
space:
mode:
authorNikolas Klauser <nikolasklauser@berlin.de>2024-02-02 19:15:58 +0100
committerGitHub <noreply@github.com>2024-02-02 19:15:58 +0100
commit9cc2122bf5a81f7063c2a32b2cb78c8d615578a1 (patch)
tree9d134f55f730dee29a90e3d5c85719d64bf5a268 /libcxx
parent1156bbc5b1837e688b0e5d6952f1a900aca29062 (diff)
downloadllvm-9cc2122bf5a81f7063c2a32b2cb78c8d615578a1.zip
llvm-9cc2122bf5a81f7063c2a32b2cb78c8d615578a1.tar.gz
llvm-9cc2122bf5a81f7063c2a32b2cb78c8d615578a1.tar.bz2
[Clang][libc++] Implement __is_nothrow_convertible and use it in libc++ (#80436)
GCC 13 has implemented this builtin.
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/include/__type_traits/is_nothrow_convertible.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/libcxx/include/__type_traits/is_nothrow_convertible.h b/libcxx/include/__type_traits/is_nothrow_convertible.h
index eda7a49..bfc5a94 100644
--- a/libcxx/include/__type_traits/is_nothrow_convertible.h
+++ b/libcxx/include/__type_traits/is_nothrow_convertible.h
@@ -26,6 +26,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
+# if __has_builtin(__is_nothrow_convertible)
+
+template <class _Tp, class _Up>
+struct is_nothrow_convertible : bool_constant<__is_nothrow_convertible(_Tp, _Up)> {};
+
+template <class _Tp, class _Up>
+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;
@@ -43,6 +53,8 @@ struct is_nothrow_convertible
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