From: Remi Gacogne Date: Wed, 19 May 2021 17:44:12 +0000 (+0200) Subject: auth: Fix a 'temporary used in loop' warning reported by g++ 11.1.0 X-Git-Tag: auth-4.5.0-alpha1~3^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F10429%2Fhead;p=thirdparty%2Fpdns.git auth: Fix a 'temporary used in loop' warning reported by g++ 11.1.0 ``` common_startup.cc: In function ‘void mainthread()’: common_startup.cc:617:24: warning: loop variable ‘algotype’ of type ‘const string&’ {aka ‘const std::__cxx11::basic_string&’} binds to a temporary constructed from type ‘const char* const’ [-Wrange-loop-construct] 617 | for (const string& algotype : {"ksk", "zsk"}) { | ^~~~~~~~ common_startup.cc:617:24: note: use non-reference type ‘const string’ {aka ‘const std::__cxx11::basic_string’} to make the copy explicit or ‘const char* const&’ to prevent copying ``` --- diff --git a/pdns/common_startup.cc b/pdns/common_startup.cc index 88963c2a46..c340596492 100644 --- a/pdns/common_startup.cc +++ b/pdns/common_startup.cc @@ -614,7 +614,7 @@ void mainthread() // Some sanity checking on default key settings bool hadKeyError = false; int kskAlgo{0}, zskAlgo{0}; - for (const string& algotype : {"ksk", "zsk"}) { + for (const string algotype : {"ksk", "zsk"}) { int algo, size; if (::arg()["default-"+algotype+"-algorithm"].empty()) continue;