diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt index f1bdf684a8549..0277382cc84dd 100644 --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -835,7 +835,6 @@ set(files __type_traits/is_member_pointer.h __type_traits/is_nothrow_assignable.h __type_traits/is_nothrow_constructible.h - __type_traits/is_nothrow_convertible.h __type_traits/is_nothrow_destructible.h __type_traits/is_null_pointer.h __type_traits/is_object.h diff --git a/libcxx/include/__type_traits/is_convertible.h b/libcxx/include/__type_traits/is_convertible.h index cef3c4a764914..f0a859f9cc16d 100644 --- a/libcxx/include/__type_traits/is_convertible.h +++ b/libcxx/include/__type_traits/is_convertible.h @@ -26,6 +26,16 @@ template _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_convertible_v = __is_convertible(_From, _To); #endif +#if _LIBCPP_STD_VER >= 20 + +template +struct _LIBCPP_NO_SPECIALIZATIONS is_nothrow_convertible : bool_constant<__is_nothrow_convertible(_Tp, _Up)> {}; + +template +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_convertible_v = __is_nothrow_convertible(_Tp, _Up); + +#endif // _LIBCPP_STD_VER >= 20 + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___TYPE_TRAITS_IS_CONVERTIBLE_H diff --git a/libcxx/include/__type_traits/is_nothrow_convertible.h b/libcxx/include/__type_traits/is_nothrow_convertible.h deleted file mode 100644 index f114619296437..0000000000000 --- a/libcxx/include/__type_traits/is_nothrow_convertible.h +++ /dev/null @@ -1,62 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___TYPE_TRAITS_IS_NOTHROW_CONVERTIBLE_H -#define _LIBCPP___TYPE_TRAITS_IS_NOTHROW_CONVERTIBLE_H - -#include <__config> -#include <__type_traits/conjunction.h> -#include <__type_traits/disjunction.h> -#include <__type_traits/integral_constant.h> -#include <__type_traits/is_convertible.h> -#include <__type_traits/is_void.h> -#include <__type_traits/lazy.h> -#include <__utility/declval.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 20 - -# if __has_builtin(__is_nothrow_convertible) - -template -struct _LIBCPP_NO_SPECIALIZATIONS is_nothrow_convertible : bool_constant<__is_nothrow_convertible(_Tp, _Up)> {}; - -template -_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_convertible_v = __is_nothrow_convertible(_Tp, _Up); - -# else // __has_builtin(__is_nothrow_convertible) - -template -void __test_noexcept(_Tp) noexcept; - -template -bool_constant(std::declval<_Fm>()))> __is_nothrow_convertible_test(); - -template -struct __is_nothrow_convertible_helper : decltype(std::__is_nothrow_convertible_test<_Fm, _To>()) {}; - -template -struct is_nothrow_convertible - : _Or<_And, is_void<_Fm>>, - _Lazy<_And, is_convertible<_Fm, _To>, __is_nothrow_convertible_helper<_Fm, _To> > >::type {}; - -template -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 - -#endif // _LIBCPP___TYPE_TRAITS_IS_NOTHROW_CONVERTIBLE_H diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in index af928a63f2315..7260c3a5d51f3 100644 --- a/libcxx/include/module.modulemap.in +++ b/libcxx/include/module.modulemap.in @@ -232,10 +232,6 @@ module std_core [system] { header "__type_traits/is_nothrow_constructible.h" export std_core.type_traits.integral_constant } - module is_nothrow_convertible { - header "__type_traits/is_nothrow_convertible.h" - export std_core.type_traits.integral_constant - } module is_nothrow_destructible { header "__type_traits/is_nothrow_destructible.h" export std_core.type_traits.integral_constant diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits index b63f61cfefe8e..9db7b2afb0cf3 100644 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -549,7 +549,6 @@ namespace std # include <__type_traits/common_reference.h> # include <__type_traits/is_bounded_array.h> # include <__type_traits/is_constant_evaluated.h> -# include <__type_traits/is_nothrow_convertible.h> # include <__type_traits/is_unbounded_array.h> # include <__type_traits/type_identity.h> # include <__type_traits/unwrap_ref.h>