1 // RUN: %clang_cc1 -std=c++2a -x c++ %s -verify
3 template<auto T
, decltype(T
) U
>
4 concept C1
= sizeof(U
) >= 4;
5 // sizeof(U) >= 4 [U = U (decltype(T))]
7 template<typename Y
, char V
>
8 concept C2
= C1
<Y
{}, V
>;
9 // sizeof(U) >= 4 [U = V (decltype(Y{}))]
12 constexpr int foo() requires C2
<int, W
> { return 1; }
13 // sizeof(U) >= 4 [U = W (decltype(int{}))]
16 // expected-note@+1{{candidate function}}
17 constexpr int foo() requires C1
<1, X
> && true { return 2; }
18 // sizeof(U) >= 4 [U = X (decltype(1))]
20 static_assert(foo
<'a'>() == 2);
23 // expected-note@+1{{candidate function}}
24 constexpr int foo() requires C2
<long long, Z
> && true { return 3; }
25 // sizeof(U) >= 4 [U = Z (decltype(long long{}))]
27 static_assert(foo
<'a'>() == 3);
28 // expected-error@-1{{call to 'foo' is ambiguous}}