| 1 |
// { dg-do compile { target c++17 } } |
| 2 |
// { dg-options "-fconcepts" } |
| 3 |
|
| 4 |
template<typename T> |
| 5 |
concept C1 = __is_class(T); |
| 6 |
|
| 7 |
template<typename T> |
| 8 |
concept C2 = __is_class(T); |
| 9 |
|
| 10 |
template<typename T> |
| 11 |
constexpr bool C3 = __is_class(T); |
| 12 |
|
| 13 |
|
| 14 |
template<typename U> |
| 15 |
requires C1<U> |
| 16 |
void f1(U) { } |
| 17 |
|
| 18 |
template<typename U> |
| 19 |
requires C2<U> |
| 20 |
void f2(U) { } |
| 21 |
|
| 22 |
template<C3 T> // { dg-error "not a type" } |
| 23 |
void f(T) { } // { dg-error "declared void|not declared" } |
| 24 |
|
| 25 |
void foo() |
| 26 |
{ |
| 27 |
struct S { } s; |
| 28 |
f2(s); |
| 29 |
// f2(0); |
| 30 |
} |