| 1 |
// RUN: %clang_cc1 -std=c++2a -x c++ %s -verify |
| 2 |
|
| 3 |
template<auto T, decltype(T) U> |
| 4 |
concept C1 = sizeof(U) >= 4; |
| 5 |
// sizeof(U) >= 4 [U = U (decltype(T))] |
| 6 |
|
| 7 |
template<typename Y, char V> |
| 8 |
concept C2 = C1<Y{}, V>; |
| 9 |
// sizeof(U) >= 4 [U = V (decltype(Y{}))] |
| 10 |
|
| 11 |
template<char W> |
| 12 |
constexpr int foo() requires C2<int, W> { return 1; } |
| 13 |
// sizeof(U) >= 4 [U = W (decltype(int{}))] |
| 14 |
|
| 15 |
template<char X> |
| 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))] |
| 19 |
|
| 20 |
static_assert(foo<'a'>() == 2); |
| 21 |
|
| 22 |
template<char Z> |
| 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{}))] |
| 26 |
|
| 27 |
static_assert(foo<'a'>() == 3); |
| 28 |
// expected-error@-1{{call to 'foo' is ambiguous}} |