aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp23/subscript15.C
blob: fece96be96ba62842e96d69d94a0fd02aa4f26d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// PR c++/111493
// { dg-do compile { target c++23 } }

template<class T, class... Ts>
concept CartesianIndexable = requires(T t, Ts... ts) { t[ts...]; };

static_assert(!CartesianIndexable<int>);
static_assert(!CartesianIndexable<int, int>);
static_assert(!CartesianIndexable<int, int, int>);

static_assert(!CartesianIndexable<int*>);
static_assert(CartesianIndexable<int*, int>);
static_assert(!CartesianIndexable<int*, int, int>);
static_assert(!CartesianIndexable<int*, int*>);

template<class... Ts>
struct A {
  void operator[](Ts...);
};

static_assert(!CartesianIndexable<A<>, int>);
static_assert(CartesianIndexable<A<int>, int>);
static_assert(!CartesianIndexable<A<int>>);
static_assert(!CartesianIndexable<A<int>, int, int>);
static_assert(CartesianIndexable<A<int, int>, int, int>);