From: Jakub Jelinek Date: Thu, 29 Mar 2018 11:18:04 +0000 (+0200) Subject: re PR c++/85108 (Incorrect warning for constexpr lambda with -Wunused-but-set-variable) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=036c9eb5d91e589ec10bb753ba2066963f9bcccc;p=gcc.git 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 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 89712e3f5b1..788dbaa48c2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2018-03-29 Jakub Jelinek + PR c++/85108 + * g++.dg/warn/Wunused-var-31.C: New test. + PR c/85094 * c-c++-common/Wduplicated-branches-14.c: New test. diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-31.C b/gcc/testsuite/g++.dg/warn/Wunused-var-31.C new file mode 100644 index 00000000000..74c016ba230 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wunused-var-31.C @@ -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; +}