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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user