Opened 10 years ago
Last modified 10 years ago
#7568 new Bugs
Unused parameter and shadowed member warnings in errors.hpp
Reported by: | Owned by: | Vladimir Prus | |
---|---|---|---|
Milestone: | To Be Determined | Component: | program_options |
Version: | Boost 1.51.0 | Severity: | Cosmetic |
Keywords: | Cc: | Vladimir Prus |
Description
This code
#include <boost/program_options/errors.hpp> int main(int, char *[]) { return 0; }
compiled with
gcc -I/path/to/boost -c -Wunused-parameter -Wshadow test.cxx
produces a warning about an unused parameter and several warnings about shadowed class members:
/opt/local/include/boost/program_options/errors.hpp:253: warning: unused parameter 'option_name' /opt/local/include/boost/program_options/errors.hpp: In constructor 'boost::program_options::invalid_syntax::invalid_syntax(boost::program_options::invalid_syntax::kind_t, const std::string&, const std::string&, int)': /opt/local/include/boost/program_options/errors.hpp:311: warning: declaration of 'kind' shadows a member of 'this' /opt/local/include/boost/program_options/errors.hpp: In constructor 'boost::program_options::invalid_config_file_syntax::invalid_config_file_syntax(const std::string&, boost::program_options::invalid_syntax::kind_t)': /opt/local/include/boost/program_options/errors.hpp:331: warning: declaration of 'kind' shadows a member of 'this' /opt/local/include/boost/program_options/errors.hpp: In constructor 'boost::program_options::invalid_command_line_syntax::invalid_command_line_syntax(boost::program_options::invalid_syntax::kind_t, const std::string&, const std::string&, int)': /opt/local/include/boost/program_options/errors.hpp:350: warning: declaration of 'kind' shadows a member of 'this'
This was compile on Mac Snow Leopard, gcc 4.2.1 with the boost distribution from macports (although I doubt any of that matters).
Note:
See TracTickets
for help on using tickets.
I also discovered another shadowed parameter warning on line 232 of value_semantic.hpp. You can see all of the warnings if you compile
with the -Wunused-parameter and -Wshadow flags.