In STD, is_convertible is not defined with Kokkos::complex nor std::complex. In practice, these should behave like
namespace std {
template<typename T1, typename T2>
struct is_convertible<T1,Kokkos::complex<T2> >, { static constexpr value = std::is_convertible<T1,T2>::value; };
struct is_convertible<T1,std::complex<T2> >, { static constexpr value = std::is_convertible<T1,T2>::value; };
}
Can we put this in the Kokkos_Complex.hpp ?
https://en.cppreference.com/w/cpp/language/extending_std
None of the templates defined in
<type_traits>may be specialized for a user-defined type, except forstd::common_type. This includes the type traits and the class templatestd::integral_constant.
Also, std::is_convertible implementations should not need an implementation for custom types. They use SFINAE to check whether an implicit assignment actually compiles. Thus, if std::is_convertible doesn't work, that suggests that implicit assignment doesn't compile.
I agree with @mhoemmen , defining our own specialization is not the right answer. If you're getting a negative result or a compile error, we should investigate why that is happening.
Agreed.