[gcn] install.texi: Update for new ISA targets and their requirements
[gcc.git] / gcc / testsuite / g++.dg / cpp23 / subscript10.C
blob96e5e1f3ed29d324faba1e3661bcc339247b4c12
1 // PR c++/107624
2 // { dg-do run { target c++11 } }
3 // { dg-options "" }
5 int n[3];
6 struct S {
7   static int &operator[] (int x) { n[0] |= (1 << x); return n[2]; }     // { dg-warning "may be a static member function only with" "" { target c++20_down } }
8 #if __cpp_multidimensional_subscript >= 202211L
9   static int &operator[] () { n[0] |= (1 << 8); return n[2]; }
10   static int &operator[] (int y, int z, int w) { n[0] |= (1 << y) | (1 << z) | (1 << w); return n[2]; }
11 #endif
12   int s;
14 volatile S s[2];
16 S &
17 foo (int x)
19   static S t;
20   n[1] |= (1 << x);
21   return t;
24 int
25 main ()
27   int i = 0;
28   foo (0) [0]++;
29   if (n[0] != 1 || n[1] != 1 || n[2] != 1)
30     __builtin_abort ();
31   s[i++][2]++;
32   if (i != 1 || n[0] != 5 || n[1] != 1 || n[2] != 2)
33     __builtin_abort ();
34 #if __cpp_multidimensional_subscript >= 202211L
35   foo (3) []++;
36   if (n[0] != 261 || n[1] != 9 || n[2] != 3)
37     __builtin_abort ();
38   int y = 10;
39   int z = 10;
40   int w = 13;
41   foo (4) [y++, ++z, w++]++;
42   if (n[0] != 11525 || n[1] != 25 || n[2] != 4
43       || y != 11 || z != 11 || w != 14)
44     __builtin_abort ();
45 #endif