+2018-05-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/85952
+ * init.c (build_aggr_init): For structured binding initialized from
+ array call mark_rvalue_use on the initializer.
+
2018-05-28 Bernd Edlinger <bernd.edlinger@hotmail.de>
* decl2.c (start_static_storage_duration_function): Use
if (VAR_P (exp) && DECL_DECOMPOSITION_P (exp))
{
from_array = 1;
+ init = mark_rvalue_use (init);
if (init && DECL_P (init)
&& !(flags & LOOKUP_ONLYCONVERTING))
{
2018-05-29 Jakub Jelinek <jakub@redhat.com>
+ PR c++/85952
+ * g++.dg/warn/Wunused-var-33.C: New test.
+
PR target/85918
* gcc.target/i386/avx512dq-pr85918.c: Add -mprefer-vector-width=512
and -fno-vect-cost-model options. Add aligned(64) attribute to the
--- /dev/null
+// PR c++/85952
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wunused-but-set-variable" }
+
+int
+foo ()
+{
+ int a[2] = {1, 2}; // { dg-bogus "set but not used" } */
+ auto [x, y] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ return x + y;
+}
+
+struct S { int d, e; };
+
+int
+bar ()
+{
+ S a = {1, 2};
+ auto [x, y] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ return x + y;
+}
+
+int
+baz ()
+{
+ S a = {1, 2};
+ auto & [x, y] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ return x + y;
+}
+
+int
+qux ()
+{
+ int a[2] = {1, 2};
+ auto & [x, y] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ return x + y;
+}