// RUN: %clang_cc1 -std=c++23 -verify %s namespace t1 { template struct enable_if { typedef void type; }; template class Foo {}; template constexpr bool check() { return true; } template struct Bar {}; namespace param { template void func(Bar()>::type>) {} // expected-note@-1 2{{candidate function}} template void func(Bar>) {} // expected-note@-1 2{{candidate function}} void g() { func(Bar>()); // expected-error {{call to 'func' is ambiguous}} void (*ptr)(Bar>){func}; // expected-error@-1 {{address of overloaded function 'func' is ambiguous}} } } // namespace param namespace ret { template Bar()>::type> func(); // expected-note@-1 {{candidate function}} template Bar> func(); // expected-note@-1 {{candidate function}} void g() { Bar> (*ptr)(){func}; // expected-error@-1 {{address of overloaded function 'func' is ambiguous}} } } // namespace ret namespace conv { struct A { template operator Bar()>::type>(); // expected-note@-1 {{candidate function}} template operator Bar>(); // expected-note@-1 {{candidate function}} }; void g() { Bar> x = A(); // expected-error@-1 {{conversion from 'A' to 'Bar>' is ambiguous}} } } // namespace conv } // namespace t1 namespace t2 { template struct enable_if; template <> struct enable_if { typedef int type; }; struct pair { template pair(int); template ::type = 0> pair(_U2 &&); }; int test_test_i; void test() { pair{test_test_i}; } } // namespace t2 namespace t3 { template void to_address(_Tp); template auto to_address(_Pointer __p) -> decltype(__p); template struct basic_string_view { basic_string_view(_CharT); template requires requires(_It __i) { to_address(__i); } basic_string_view(_It); }; void operatorsv() { basic_string_view(0); } } // namespace t3 namespace func_pointer { template struct __promote { using type = float; }; template class complex {}; namespace ret { template complex<_Tp> pow(const complex<_Tp> &) {}; template complex::type> pow(_Tp) = delete; complex (*ptr)(const complex &){pow}; } // namespace ret namespace param { template void pow(const complex<_Tp> &, complex<_Tp>) {}; template void pow(_Tp, complex::type>) = delete; void (*ptr)(const complex &, complex){pow}; } // namespace param } // namespace func_pointer namespace static_vs_nonstatic { namespace implicit_obj_param { struct A { template static void f(int a, Args... args) {} template void f(Args... args) = delete; }; void g(){ A::f(0); } } // namespace implicit_obj_param namespace explicit_obj_param { struct A { template static void f(int, Args... args) {} template void f(this A *, Args... args) = delete; }; void g(){ A::f(0); } } // namespace explicit_obj_param } // namespace static_vs_nonstatic namespace incomplete_on_sugar { template void f(T[P]) = delete; template void f(int[][P]); void test() { int array[1][8]; f<8>(array); } } // namespace incomplete_on_sugar