gcc/testsuite/g++.dg/cpp1z/decomp21.C
raw| 1 | // { dg-do compile { target c++17 } } |
| 2 | |
| 3 | int a[3]; |
| 4 | struct S { int b, c, d; } s; |
| 5 | void |
| 6 | foo () |
| 7 | { |
| 8 | auto [ b, c, d ] = a; |
| 9 | auto [ e, f, g ] = s; |
| 10 | auto [ h, i, j ] { s }; |
| 11 | auto [ k, l, m ] { s, }; |
| 12 | auto [ n, o, p ] { a }; |
| 13 | auto [ q, r, t ] ( s ); |
| 14 | auto [ u, v, w ] ( s, ); // { dg-error "expected primary-expression before '.' token" } |
| 15 | // { dg-error "invalid initializer for structured binding declaration" "" { target *-*-* } .-1 } |
| 16 | auto [ x, y, z ] ( a ); |
| 17 | } |