From 68235c436d193817c4860a460a1144bb2c2e0f80 Mon Sep 17 00:00:00 2001 From: MichelJuillard <michel.juillard@mjui.fr> Date: Wed, 6 Dec 2023 19:23:30 +0100 Subject: [PATCH] fix clang local binding error --- src/SubModel.cc | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/SubModel.cc b/src/SubModel.cc index 38b729ba..a63ec07c 100644 --- a/src/SubModel.cc +++ b/src/SubModel.cc @@ -1285,18 +1285,21 @@ 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, -- GitLab