This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/81299] Spurious "set but not used" warning with constexpr variable


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]