| 1 |
// { dg-do compile { target c++20 } } |
| 2 |
// { dg-additional-options "-fconcepts" } |
| 3 |
|
| 4 |
template<typename F> |
| 5 |
concept FCallable = |
| 6 |
requires(F) |
| 7 |
{ |
| 8 |
F::f(); |
| 9 |
}; |
| 10 |
|
| 11 |
|
| 12 |
class Test1 |
| 13 |
{ |
| 14 |
public: |
| 15 |
template<FCallable P, FCallable... Pp> |
| 16 |
static void g() |
| 17 |
{ |
| 18 |
(Pp::f(), ...); |
| 19 |
} |
| 20 |
}; |
| 21 |
|
| 22 |
class A |
| 23 |
{ |
| 24 |
public: |
| 25 |
static void f() {} |
| 26 |
}; |
| 27 |
|
| 28 |
template<typename X> concept C = true; |
| 29 |
|
| 30 |
template<C... X> |
| 31 |
void bar(X...) |
| 32 |
{} |
| 33 |
|
| 34 |
struct foo |
| 35 |
{ |
| 36 |
template<C... X> |
| 37 |
void bar(X...) |
| 38 |
{} |
| 39 |
}; |
| 40 |
|
| 41 |
int main() |
| 42 |
{ |
| 43 |
Test1::template g<A>(); |
| 44 |
bar(); |
| 45 |
foo {}.bar(); |
| 46 |
} |
| 47 |
|