| 1 |
// { dg-do run { target c++11 } } |
| 2 |
// { dg-options "" } |
| 3 |
|
| 4 |
int a[2] = { 1, 2 }; |
| 5 |
struct S { int a; signed char b; float c; } s = { 6, 7, 8.0f }; |
| 6 |
|
| 7 |
int |
| 8 |
main () |
| 9 |
{ |
| 10 |
auto & [ c, d ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } } |
| 11 |
auto [ e, f ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } } |
| 12 |
auto [ g, h, i ] = s; // { dg-warning "structured bindings only available with" "" { target c++14_down } } |
| 13 |
auto & [ j, k, l ] = s; // { dg-warning "structured bindings only available with" "" { target c++14_down } } |
| 14 |
c++; |
| 15 |
d++; |
| 16 |
e += 6; |
| 17 |
f += 7; |
| 18 |
g++; |
| 19 |
h++; |
| 20 |
j += 10; |
| 21 |
k += 11; |
| 22 |
if (c != 2 || &c != &a[0] |
| 23 |
|| d != 3 || &d != &a[1] |
| 24 |
|| e != 7 || &e == &a[0] |
| 25 |
|| f != 9 || &f == &a[1] |
| 26 |
|| g != 7 || &g == &s.a |
| 27 |
|| h != 8 || &h == &s.b |
| 28 |
|| i != 8.0f || &i == &s.c |
| 29 |
|| j != 16 || &j != &s.a |
| 30 |
|| k != 18 || &k != &s.b |
| 31 |
|| l != 8.0f || &l != &s.c |
| 32 |
|| a[0] != 2 || a[1] != 3 |
| 33 |
|| s.a != 16 || s.b != 18 || s.c != 8.0f) |
| 34 |
__builtin_abort (); |
| 35 |
} |