gcc/testsuite/g++.dg/cpp2a/concepts-requires9.C
raw| 1 | // PR c++/66832 |
| 2 | // { dg-do compile { target c++20 } } |
| 3 | |
| 4 | template <class T, class U, unsigned N> |
| 5 | requires requires (T& t, U &u) { t.foo(); u.foo(); } |
| 6 | void foo_all( T (&t)[N], U (&u)[N] ) { |
| 7 | for(auto& x : t) |
| 8 | x.foo(); |
| 9 | for(auto& x : u) |
| 10 | x.foo(); |
| 11 | } |
| 12 | |
| 13 | struct S { |
| 14 | void foo() {} |
| 15 | }; |
| 16 | |
| 17 | int main() { |
| 18 | S rg[4] {}; |
| 19 | foo_all(rg, rg); |
| 20 | } |
| 21 |