lambda parameter ‘miscAssets’ previously declared as a capture (World/ProvinceDefinition.cpp)
Closed this issue · 3 comments
GregTheMadMonk commented
When compiling OpenTESArena, compiler throws an error:
/home/greg/projects/cpp/OpenTESArena/OpenTESArena/src/World/ProvinceDefinition.cpp:29:68: error: lambda parameter ‘miscAssets’ previously declared as a capture
29 | LocationDefinition::CityDefinition::Type type, const MiscAssets &miscAssets)
The lines that cause the error:
OpenTESArena/OpenTESArena/src/World/ProvinceDefinition.cpp
Lines 27 to 29 in c45335d
According to this StackOverflow answer, even if the code compiled, it would've used the parameter
miscAssets, not the captured one. As expected, when miscAssets is removed from capture list, game compiles and runs.The other way around this issue is removing
const MiscAssets &miscAssets from lambda parameters, and removing an extra parameter in callas it seems to be the only place that calls
tryAddCity and miscAssets captured there is the same as captured in tryAddCity.This solution also leads to the game compiling and running.
My gcc --version:
gcc (Arch Linux 9.3.0-1) 9.3.0
Sorry if my english is hard to understand sometimes)
afritz1 commented
That was a minor derp on my part. It should probably use the captured miscAssets instead. I'll make a fix soon.
afritz1 commented
Should be fixed in commit 1d244cb. Strangely Travis CI didn't complain about it in the first place.
GregTheMadMonk commented
Yup, it helped.