[Bug c++/96311] false positive for -Wunused-but-set-variable (const/constexpr identifier used in generic lambda)
marxin at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 27 07:11:11 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96311
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
CC| |marxin at gcc dot gnu.org
Last reconfirmed| |2020-07-27
Status|UNCONFIRMED |WAITING
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, but it seems the code is rejected with clang:
pr96311.c:6:10: error: variable 'used' cannot be implicitly captured in a
lambda with no capture-default specified
return used;
^
pr96311.c:3:16: note: 'used' declared here
constexpr int used = 0;
^
pr96311.c:4:2: note: lambda expression begins here
[](auto unused)
^
pr96311.c:4:2: warning: expression result unused [-Wunused-value]
[](auto unused)
^~~~~~~~~~~~~~~
2 warnings and 1 error generated.
Is it a valid test-case?
More information about the Gcc-bugs
mailing list