From: Remi Gacogne Date: Wed, 19 May 2021 17:23:24 +0000 (+0200) Subject: test-dnsname_cc.cc: Fix a 'temporary used in loop' warning reported by g++ 11.1.0 X-Git-Tag: auth-4.5.0-alpha1~3^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9003e375f5bef7860cd2a9d7e3248a8005841d5a;p=thirdparty%2Fpdns.git test-dnsname_cc.cc: Fix a 'temporary used in loop' warning reported by g++ 11.1.0 ``` test-dnsname_cc.cc: In member function ‘void test_dnsname_cc::test_compare_canonical::test_method()’: test-dnsname_cc.cc:684:26: warning: loop variable ‘b’ of type ‘const string&’ {aka ‘const std::__cxx11::basic_string&’} binds to a temporary constructed from type ‘const char* const’ [-Wrange-loop-construct] 684 | for(const std::string& b : {"bert.com.", "alpha.nl.", "articles.xxx.", | ^ test-dnsname_cc.cc:684:26: 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/test-dnsname_cc.cc b/pdns/test-dnsname_cc.cc index cc80a0fab8..af1b2571c1 100644 --- a/pdns/test-dnsname_cc.cc +++ b/pdns/test-dnsname_cc.cc @@ -681,7 +681,7 @@ BOOST_AUTO_TEST_CASE(test_compare_canonical) { BOOST_CHECK(!a(DNSName("www.powerdns.net"), g_rootdnsname)); vector vec; - for(const std::string& b : {"bert.com.", "alpha.nl.", "articles.xxx.", + for(const char* b : {"bert.com.", "alpha.nl.", "articles.xxx.", "Aleph1.powerdns.com.", "ZOMG.powerdns.com.", "aaa.XXX.", "yyy.XXX.", "test.powerdns.com.", "\\128.com"}) { vec.push_back(DNSName(b));