[Bug c++/61951] -Wextra switch produce warning: parameter 'ptr' set but not used [-Wunused-but-set-parameter]
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Sep 17 16:56:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61951
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Is there anything wrong on the warning though?
[](Base* ptr){ ptr = new Deliv(); }
I think ptr here is lambda parameter, does it behave any different from
parameter to any other function?
void foo (Base* ptr) { ptr = new Deliv(); }
warns about parameter 'ptr' set but not used intentionally, so why shouldn't it
we warn about it in the lambda? Doesn't the lambda just leak memory and not
actually store the pointer anywhere (it stores it into the parameter which is
never used)?
More information about the Gcc-bugs
mailing list