gcc/testsuite/g++.dg/cpp23/subscript7.C
raw| 1 | // PR c++/103460 |
| 2 | // { dg-do compile } |
| 3 | // { dg-options "-std=c++23" } |
| 4 | |
| 5 | struct S { |
| 6 | int &operator[] (int, ...); |
| 7 | } s; |
| 8 | struct T { |
| 9 | int &operator[] (auto...); |
| 10 | } t; |
| 11 | struct U { |
| 12 | int &operator[] (...); |
| 13 | } u; |
| 14 | |
| 15 | int a = s[1] + s[2, 1] + s[3, 2, 1] + s[4, 3, 2, 1] |
| 16 | + t[0.0] + t[nullptr, s, 42] |
| 17 | + u[] + u[42] + u[1.5L, 1LL]; |