| 1 |
// { dg-do compile { target c++20 } } |
| 2 |
|
| 3 |
template<typename T> |
| 4 |
concept C = __is_class(T); |
| 5 |
|
| 6 |
template<typename T> |
| 7 |
concept D = C<T> && __is_empty(T); |
| 8 |
|
| 9 |
struct X { }; |
| 10 |
struct Y { int n; }; |
| 11 |
|
| 12 |
template<typename T> |
| 13 |
struct S { |
| 14 |
void f() { } // #1 |
| 15 |
void f() requires C<T> { } // #2 |
| 16 |
|
| 17 |
void g() requires C<T> { } // #1 |
| 18 |
void g() requires D<T> { } // #2 |
| 19 |
}; |
| 20 |
|
| 21 |
template void S<int>::f(); // #1 |
| 22 |
template void S<X>::f(); // #2 |
| 23 |
|
| 24 |
template void S<X>::g(); // #2 |
| 25 |
template void S<Y>::g(); // #1 |
| 26 |
|
| 27 |
int main() { } |