// { dg-do compile { target c++20 } } #if __has_builtin (__is_deducible) template struct A { }; template struct B { }; // Simple forms. static_assert (__is_deducible (::A, A)); static_assert (__is_deducible (B, B)); static_assert (!__is_deducible (A, B)); static_assert (!__is_deducible (::B, A)); // This is the interesting use case for alias CTAD. template using AP = A; static_assert (__is_deducible (AP, A)); static_assert (!__is_deducible (AP, A)); // Can't deduce a parameter not used on the RHS. template using C = void; static_assert (!__is_deducible (C, C)); // But a default template argument counts. template using D = void; static_assert (__is_deducible (D, D)); // P0127 array bound type deduction should work here. template using E = int[N]; static_assert (__is_deducible (E, int[42])); #endif // __has_builtin (__is_deducible) // We don't try to support this. template void f(T); bool b = __is_deducible (f, void (int)); // { dg-error "" }