| 1 |
// PR c++/79372 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-options "" } |
| 4 |
|
| 5 |
template <typename T> |
| 6 |
struct S |
| 7 |
{ |
| 8 |
enum E { A }; |
| 9 |
void f () { auto [x] = 0; x++; } // { dg-error "cannot decompose non-array non-class type" } |
| 10 |
// { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 } |
| 11 |
void g (T t) { auto [y] = t; y++; } // { dg-error "cannot decompose non-array non-class type" } |
| 12 |
}; // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 } |
| 13 |
|
| 14 |
int |
| 15 |
main () |
| 16 |
{ |
| 17 |
S <int> s; |
| 18 |
s.f (); |
| 19 |
s.g (5); |
| 20 |
} |