PR c++/85108
* g++.dg/warn/Wunused-var-31.C: New test.
From-SVN: r258952
2018-03-29 Jakub Jelinek <jakub@redhat.com>
+ PR c++/85108
+ * g++.dg/warn/Wunused-var-31.C: New test.
+
PR c/85094
* c-c++-common/Wduplicated-branches-14.c: New test.
--- /dev/null
+// PR c++/85108
+// { dg-do compile { target c++17 } }
+// { dg-options "-Wunused-but-set-variable" }
+
+int
+main ()
+{
+ auto constexpr add = [] (auto a, auto b) { return a + b; }; // { dg-bogus "set but not used" }
+ auto test_lambda = [&] () { return add (2, 2); };
+ return test_lambda () - 4;
+}