1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
2 
3 struct A;
4 struct B;
5 
6 template <typename> constexpr bool True = true;
7 template <typename T> concept C = True<T>;
8 
9 void f(C auto &, auto &) = delete;
10 template <C Q> void f(Q &, C auto &);
11 
g(struct A * ap,struct B * bp)12 void g(struct A *ap, struct B *bp) {
13   f(*ap, *bp);
14 }
15 
16 template <typename T, typename U> struct X {};
17 
18 template <typename T, C U, typename V> bool operator==(X<T, U>, V) = delete;
19 template <C T, C U, C V>               bool operator==(T, X<U, V>);
20 
h()21 bool h() {
22   return X<void *, int>{} == 0;
23 }
24 
25 namespace PR53640 {
26 
27 template <typename T>
28 concept C = true;
29 
30 template <C T>
f(T t)31 void f(T t) {} // expected-note {{candidate function [with T = int]}}
32 
33 template <typename T>
f(const T & t)34 void f(const T &t) {} // expected-note {{candidate function [with T = int]}}
35 
g()36 int g() {
37   f(0); // expected-error {{call to 'f' is ambiguous}}
38 }
39 
40 struct S {
SPR53640::S41   template <typename T> explicit S(T) noexcept requires C<T> {} // expected-note {{candidate constructor}}
SPR53640::S42   template <typename T> explicit S(const T &) noexcept {}       // expected-note {{candidate constructor}}
43 };
44 
h()45 int h() {
46   S s(4); // expected-error-re {{call to constructor of {{.*}} is ambiguous}}
47 }
48 
49 }
50