PR c++/85952
[official-gcc.git] / gcc / testsuite / g++.dg / warn / Wunused-var-33.C
blob080a4f81d7286c6abc51c21ebc30cd2d25ee59e1
1 // PR c++/85952
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-Wunused-but-set-variable" }
5 int
6 foo ()
8   int a[2] = {1, 2};    // { dg-bogus "set but not used" } */
9   auto [x, y] = a;      // { dg-warning "structured bindings only available with" "" { target c++14_down } }
10   return x + y;
13 struct S { int d, e; };
15 int
16 bar ()
18   S a = {1, 2};
19   auto [x, y] = a;      // { dg-warning "structured bindings only available with" "" { target c++14_down } }
20   return x + y;
23 int
24 baz ()
26   S a = {1, 2};
27   auto & [x, y] = a;    // { dg-warning "structured bindings only available with" "" { target c++14_down } }
28   return x + y;
31 int
32 qux ()
34   int a[2] = {1, 2};
35   auto & [x, y] = a;    // { dg-warning "structured bindings only available with" "" { target c++14_down } }
36   return x + y;