From 4ac9845f07adad6260d5126ef820d72d18619e46 Mon Sep 17 00:00:00 2001 From: Kp Date: Thu, 4 Nov 2021 03:24:43 +0000 Subject: [PATCH] Fix clang build of fuelcen.cpp clang treats names introduced by structured bindings specially, and refuses to capture them for a lambda, even when it should be capturing an rvalue reference. gcc accepts this capture. Switch to initializing a lambda local variable from the structured binding in the outer scope, which works with both compilers. Reported-by: Kreeblah --- similar/main/fuelcen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/similar/main/fuelcen.cpp b/similar/main/fuelcen.cpp index bf65fad67..af40f6824 100644 --- a/similar/main/fuelcen.cpp +++ b/similar/main/fuelcen.cpp @@ -653,7 +653,7 @@ void init_all_matcens(void) station.Enabled = 0; station.Disable_time = 0; // Make sure this fuelcen is pointed at by a matcen. - if (std::find_if(robot_range.begin(), robot_range.end(), [i](const matcen_info &mi) { + if (std::find_if(robot_range.begin(), robot_range.end(), [i = i](const matcen_info &mi) { return mi.fuelcen_num == i; }) == robot_range.end()) {