129 | @@ -130,7 +130,7 @@ bool ExecuteWalletToolFunc(const std::string& command, const std::string& name)
130 | std::vector<bilingual_str> warnings;
131 | bool ret = RecoverDatabaseFile(path, error, warnings);
132 | if (!ret) {
133 | - for (const auto warning : warnings) {
134 | + for (const auto& warning : warnings) {
IIUC, this change prevents -Wrange-loop-analysis warning/error. But on my system (Linux Mint 20 x86_64, Ubuntu 20.04 code base, clang version 10.0.0-4ubuntu1) I cannot see a such warning.
How could i reproduce it?
Ok, I can see this warning on macOS 10.15.6 with Apple's clang (Apple LLVM version 11.0.3 (clang-1103.0.32.29)):
wallet/wallettool.cpp:133:33: warning: loop variable 'warning' of type 'const bilingual_str' creates a copy from type 'const bilingual_str' [-Wrange-loop-analysis]
for (const auto warning : warnings) {
^
wallet/wallettool.cpp:133:22: note: use reference type 'const bilingual_str &' to prevent copying
for (const auto warning : warnings) {
^~~~~~~~~~~~~~~~~~~~
1 warning generated.
I think 6afb234ee28d1635944bf25d5c7e8b4f6232d077 demo is not required :)
I was wrong: the warning is reproducible with clang version 10.0.0-4ubuntu1.
Yes there is nothing macOS specific going on here.