#ifndef LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CONVERTIBLE_H
#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CONVERTIBLE_H
#include "src/__support/CPP/type_traits/is_void.h"
#include "src/__support/CPP/utility/declval.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
namespace detail {
template <class T>
auto test_returnable(int)
-> decltype(void …);
template <class> auto test_returnable(...) -> cpp::false_type;
template <class From, class To>
auto test_implicitly_convertible(int)
-> decltype(void …);
template <class, class>
auto test_implicitly_convertible(...) -> cpp::false_type;
}
template <class From, class To>
struct is_convertible
: cpp::bool_constant<
(decltype(detail::test_returnable<To>(0))::value &&
decltype(detail::test_implicitly_convertible<From, To>(0))::value) ||
(cpp::is_void_v<From> && cpp::is_void_v<To>)> { … };
is_convertible_v;
}
}
#endif