| 1 |
// { dg-do run { target c++23 } } |
| 2 |
// { dg-options "--embed-dir=${srcdir}/c-c++-common/cpp/embed-dir" } |
| 3 |
|
| 4 |
const unsigned char m[] = { |
| 5 |
#embed <magna-carta.txt> limit (136) |
| 6 |
}; |
| 7 |
|
| 8 |
struct S |
| 9 |
{ |
| 10 |
S () : a {} {}; |
| 11 |
template <typename ...T> |
| 12 |
int &operator[] (T... args) |
| 13 |
{ |
| 14 |
int b[] = { args... }; |
| 15 |
for (int i = 0; i < sizeof (b) / sizeof (b[0]); ++i) |
| 16 |
if (b[i] != m[i]) |
| 17 |
return a[137]; |
| 18 |
return a[sizeof (b) / sizeof (b[0])]; |
| 19 |
} |
| 20 |
int a[138]; |
| 21 |
}; |
| 22 |
|
| 23 |
S s; |
| 24 |
|
| 25 |
int |
| 26 |
main () |
| 27 |
{ |
| 28 |
if (&s[ |
| 29 |
#embed <magna-carta.txt> limit (1) |
| 30 |
] != &s.a[1]) |
| 31 |
__builtin_abort (); |
| 32 |
if (&s[ |
| 33 |
#embed <magna-carta.txt> limit (6) |
| 34 |
] != &s.a[6]) |
| 35 |
__builtin_abort (); |
| 36 |
if (&s[ |
| 37 |
#embed <magna-carta.txt> limit (135) |
| 38 |
] != &s.a[135]) |
| 39 |
__builtin_abort (); |
| 40 |
} |