| 1 |
// P1381R1 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-options "-Wno-c++20-extensions" } |
| 4 |
|
| 5 |
struct Foo { int a : 1; int b; }; |
| 6 |
|
| 7 |
int main() { |
| 8 |
auto[a, b] = Foo(); // { dg-warning "structured bindings only available with" "" { target c++14_down } } |
| 9 |
|
| 10 |
auto f1 = [&] { return a; }; // { dg-error "cannot bind bit-field" } |
| 11 |
auto f2 = [&a = a] { return a; }; // { dg-error "cannot bind bit-field" } |
| 12 |
// { dg-warning "lambda capture initializers only available with" "" { target c++11_only } .-1 } |
| 13 |
auto f3 = [&a] { return a; }; // { dg-error "cannot bind bit-field" } |
| 14 |
|
| 15 |
auto g1 = [&] { return b; }; |
| 16 |
auto g2 = [&b = b] { return b; }; // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } } |
| 17 |
auto g3 = [&b] { return b; }; |
| 18 |
|
| 19 |
auto h1 = [=] { return a; }; |
| 20 |
auto h2 = [a = a] { return a; }; // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } } |
| 21 |
auto h3 = [a] { return a; }; |
| 22 |
|
| 23 |
auto i1 = [=] { return b; }; |
| 24 |
auto i2 = [b = b] { return b; }; // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } } |
| 25 |
auto i3 = [b] { return b; }; |
| 26 |
} |