re PR c++/85108 (Incorrect warning for constexpr lambda with -Wunused-but-set-variable)

PR c++/85108
	* g++.dg/warn/Wunused-var-31.C: New test.

From-SVN: r258952
This commit is contained in:
Jakub Jelinek 2018-03-29 13:18:04 +02:00 committed by Jakub Jelinek
parent 972e1985d4
commit 036c9eb5d9
2 changed files with 14 additions and 0 deletions

View File

@ -1,5 +1,8 @@
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.

View File

@ -0,0 +1,11 @@
// 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;
}