2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1z / decomp25.C
blobd90e665add0390bb7814f8583ea32f911bbbbd10
1 // PR c++/79372
2 // { dg-do compile { target c++11 } }
3 // { dg-options "" }
5 template <typename T>
6 struct S
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 }
14 int
15 main ()
17   S <int> s;
18   s.f ();
19   s.g (5);