openSUSE / zypper

World's most powerful command line package manager
http://en.opensuse.org/Portal:Zypper
Other
405 stars 110 forks source link

Fix compiler warning #417

Closed t-8ch closed 2 years ago

t-8ch commented 2 years ago

Fix the following warning observed on g++ (GCC) 11.1.0

[ 96%] Building CXX object src/CMakeFiles/zypper_lib.dir/utils/flags/zyppflags.cc.o
src/utils/flags/zyppflags.cc: In function ‘int zypp::ZyppFlags::parseCLI(int, char* const*, const std::vector<zypp::ZyppFlags::CommandGroup>&)’:
src/utils/flags/zyppflags.cc:413:37: warning: loop variable ‘conflicting’ creates a copy from type ‘const string’ {aka ‘const std::__cxx11::basic_string<char>’} [-Wrange-loop-construct]
  413 |             for ( const std::string conflicting : conflictingList ){
      |                                     ^~~~~~~~~~~
src/utils/flags/zyppflags.cc:413:37: note: use reference type to prevent copying
  413 |             for ( const std::string conflicting : conflictingList ){
      |                                     ^~~~~~~~~~~
      |                                     &
mlandres commented 2 years ago

Thanks!