1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

FASTBuild: fix use-after-move

Since order of parameters' evaluation
is unspecified in C++, it might happen that
we move `val` before we call `substt()`.
This commit is contained in:
Eduard Voronkin
2025-09-29 14:48:46 -07:00
parent 05a3f4a30d
commit 05360d19e9

View File

@@ -273,10 +273,10 @@ void cmGlobalFastbuildGenerator::ProcessEnvironment()
LocalEnvironment.emplace_back(std::move(val));
}
};
for (auto& val : cmList{ EnvOverrides }) {
for (auto const& val : cmList{ EnvOverrides }) {
auto const pos = val.find('=');
if (pos != std::string::npos && ((pos + 1) < val.size())) {
overrideEnvVar(val.substr(0, pos + 1), std::move(val));
overrideEnvVar(val.substr(0, pos + 1), val);
}
}
}