| 1 |
// { dg-do compile { target c++20 } } |
| 2 |
|
| 3 |
template<typename T> |
| 4 |
concept check_c = false; |
| 5 |
|
| 6 |
template<typename T> |
| 7 |
concept c1 = requires (T x) { |
| 8 |
requires check_c<decltype(x)>; |
| 9 |
}; |
| 10 |
|
| 11 |
template<c1 T> |
| 12 |
void f1() { } |
| 13 |
|
| 14 |
template<typename T> |
| 15 |
void f2(T x) requires requires { requires check_c<decltype(x)>; } { } |
| 16 |
|
| 17 |
|
| 18 |
template<typename T> |
| 19 |
constexpr bool check_f() { return false; } |
| 20 |
|
| 21 |
template<typename T> |
| 22 |
concept c2 = requires (T x) { |
| 23 |
requires check_f<decltype(x)>(); |
| 24 |
}; |
| 25 |
|
| 26 |
template<c2 T> |
| 27 |
void f3() { } |
| 28 |
|
| 29 |
template<typename T> |
| 30 |
void f4(T x) requires requires { requires check_f<decltype(x)>(); } { } |
| 31 |
|
| 32 |
|
| 33 |
template<typename T> |
| 34 |
constexpr bool check_v = false; |
| 35 |
|
| 36 |
template<typename T> |
| 37 |
concept c3 = requires (T x) { |
| 38 |
requires check_v<decltype(x)>; |
| 39 |
}; |
| 40 |
|
| 41 |
template<c3 T> |
| 42 |
void f5() { } |
| 43 |
|
| 44 |
template<typename T> |
| 45 |
void f6(T x) requires requires { requires check_v<decltype(x)>; } { } |
| 46 |
|
| 47 |
|
| 48 |
void test() |
| 49 |
{ |
| 50 |
f1<int>(); // { dg-error "no match" } |
| 51 |
f2(0); // { dg-error "no match" } |
| 52 |
|
| 53 |
f3<int>(); // { dg-error "no match" } |
| 54 |
f4(0); // { dg-error "no match" } |
| 55 |
|
| 56 |
f5<int>(); // { dg-error "no match" } |
| 57 |
f6(0); // { dg-error "no match" } |
| 58 |
} |