testsuite: 32 bit AIX 2 byte wchar
[official-gcc.git] / gcc / testsuite / g++.dg / cpp23 / subscript9.C
blob72cea4b8cab6eecf309e1130cb870de0d43e9508
1 // P2589R1
2 // { dg-do run { target c++23 } }
4 extern "C" void abort ();
6 struct S
8   S () {};
9   static int &operator[] () { return a[0]; }
10   static int &operator[] (int x) { return a[x]; }
11   static int &operator[] (int x, long y) { return a[x + y * 8]; }
12   static int a[64];
14 int S::a[64];
16 int
17 main ()
19   S s;
20   for (int i = 0; i < 64; i++)
21     s.a[i] = 64 - i;
22   if (s[] != 64 || s[3] != 61 || s[4, 5] != 20)
23     abort ();
24   s[]++;
25   s[42]++;
26   ++s[3, 2];
27   if (s.a[0] != 65 || s.a[42] != 23 || s.a[19] != 46)
28     abort ();