| 1 |
// P0614R1 |
| 2 |
// { dg-do run } |
| 3 |
// { dg-options "-std=c++2a" } |
| 4 |
|
| 5 |
struct A { int i; long long j; } a[64]; |
| 6 |
|
| 7 |
int |
| 8 |
main () |
| 9 |
{ |
| 10 |
for (int i = 0; auto &x : a) |
| 11 |
{ |
| 12 |
x.i = i; |
| 13 |
x.j = 2 * i++; |
| 14 |
} |
| 15 |
for (auto & [ x, y ] : a) |
| 16 |
{ |
| 17 |
x += 2; |
| 18 |
y += 3; |
| 19 |
} |
| 20 |
for (int i = 0; const auto [ u, v ] : a) |
| 21 |
{ |
| 22 |
if (u != i + 2 || v != 2 * i++ + 3) |
| 23 |
__builtin_abort (); |
| 24 |
} |
| 25 |
for (int i = 0; auto [ x, y ] : a) |
| 26 |
{ |
| 27 |
x += 4; |
| 28 |
y += 5; |
| 29 |
if (x != i + 6 || y != 2 * i++ + 8) |
| 30 |
__builtin_abort (); |
| 31 |
} |
| 32 |
for (int i = 0; const auto x : a) |
| 33 |
{ |
| 34 |
if (x.i != i + 2 || x.j != 2 * i++ + 3) |
| 35 |
__builtin_abort (); |
| 36 |
} |
| 37 |
} |