From b0cb1a728cc25f574879042971e94bc49834d96e Mon Sep 17 00:00:00 2001 From: MichelJuillard <michel.juillard@mjui.fr> Date: Sat, 21 Jan 2023 11:49:05 +0100 Subject: [PATCH] fix clang local binding error --- src/SubModel.cc | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/SubModel.cc b/src/SubModel.cc index 1dd859cf..20817350 100644 --- a/src/SubModel.cc +++ b/src/SubModel.cc @@ -1227,15 +1227,18 @@ PacModelTable::transformPass(const lag_equivalence_table_t &unary_ops_nodes, // Associate the coefficients of the linear combination with the right components for (auto [var, coeff] : terms) - if (auto it = find_if(components.begin(), components.end(), - [&](const auto &v) { return get<0>(v) == dynamic_model.AddVariable(var); }); - it != components.end()) - get<4>(*it) = coeff; - else - { - cerr << "ERROR: the model equation defining the 'target' of 'pac_target_info(" << name << ")' contains a variable (" << symbol_table.getName(var) << ") that is not declared as a 'component'" << endl; - exit(EXIT_FAILURE); - } + { + auto var1 = var; + if (auto it = find_if(components.begin(), components.end(), + [&](const auto &v) { return get<0>(v) == dynamic_model.AddVariable(var1); }); + it != components.end()) + get<4>(*it) = coeff; + else + { + cerr << "ERROR: the model equation defining the 'target' of 'pac_target_info(" << name << ")' contains a variable (" << symbol_table.getName(var1) << ") that is not declared as a 'component'" << endl; + exit(EXIT_FAILURE); + } + } // Verify that all declared components appear in that equation for (const auto &[component, growth_component, auxname, kind, coeff, growth_neutrality_param, h_indices, original_growth_component, growth_component_info] : components) -- GitLab