[Bug c++/81299] Spurious "set but not used" warning with constexpr variable
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jul 4 13:13:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81299
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |jason at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
If fun is just const and not constexpr, then we mark it TREE_USED during
build_capture_proxy, if it is not const nor constexpr, then when force_rvalue
in build_lambda_capture. But when it is constexpr, it goes through none of
that. Not sure what to do, for constexpr vars the -Wunused-but-set-variable
warning doesn't make much sense, one can't set them except for the initializer,
and so either the var is unused except for the declaration with the
initializer, then we should emit normal -Wuninitialized warning, or it is not
unused, then we just shouldn't warn.
More information about the Gcc-bugs
mailing list