| 1 |
// PR c++/111493 |
| 2 |
// { dg-do compile { target c++23 } } |
| 3 |
|
| 4 |
template<class T, class... Ts> |
| 5 |
concept CartesianIndexable = requires(T t, Ts... ts) { t[ts...]; }; |
| 6 |
|
| 7 |
static_assert(!CartesianIndexable<int>); |
| 8 |
static_assert(!CartesianIndexable<int, int>); |
| 9 |
static_assert(!CartesianIndexable<int, int, int>); |
| 10 |
|
| 11 |
static_assert(!CartesianIndexable<int*>); |
| 12 |
static_assert(CartesianIndexable<int*, int>); |
| 13 |
static_assert(!CartesianIndexable<int*, int, int>); |
| 14 |
static_assert(!CartesianIndexable<int*, int*>); |
| 15 |
|
| 16 |
template<class... Ts> |
| 17 |
struct A { |
| 18 |
void operator[](Ts...); |
| 19 |
}; |
| 20 |
|
| 21 |
static_assert(!CartesianIndexable<A<>, int>); |
| 22 |
static_assert(CartesianIndexable<A<int>, int>); |
| 23 |
static_assert(!CartesianIndexable<A<int>>); |
| 24 |
static_assert(!CartesianIndexable<A<int>, int, int>); |
| 25 |
static_assert(CartesianIndexable<A<int, int>, int, int>); |