| 1 |
// PR c++/118719 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-options "" } |
| 4 |
|
| 5 |
int |
| 6 |
main () |
| 7 |
{ |
| 8 |
int a[] = { 42 }; |
| 9 |
auto [x] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } } |
| 10 |
// { dg-message "declared here" "" { target c++17_down } .-1 } |
| 11 |
[=] () { int b = x; (void) b; }; // { dg-warning "captured structured bindings are a C\\\+\\\+20 extension" "" { target c++17_down } } |
| 12 |
[&] () { int b = x; (void) b; }; // { dg-warning "captured structured bindings are a C\\\+\\\+20 extension" "" { target c++17_down } } |
| 13 |
[x] () { int b = x; (void) b; }; // { dg-warning "captured structured bindings are a C\\\+\\\+20 extension" "" { target c++17_down } } |
| 14 |
[&x] () { int b = x; (void) b; }; // { dg-warning "captured structured bindings are a C\\\+\\\+20 extension" "" { target c++17_down } } |
| 15 |
[x = x] () { int b = x; (void) b; }; // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } } |
| 16 |
[y = x] () { int b = y; (void) b; }; // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } } |
| 17 |
[y = x * 2] () { int b = y; (void) b; }; // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } } |
| 18 |
} |