diff --git a/preprocessor/DynamicModel.cc b/preprocessor/DynamicModel.cc index e80d0a1269818289c6a350648879670c02e66f71..d4d37156870bddaffec3be10cbc709e5ab972f3d 100644 --- a/preprocessor/DynamicModel.cc +++ b/preprocessor/DynamicModel.cc @@ -4175,3 +4175,16 @@ DynamicModel::fillEvalContext(eval_context_t &eval_context) const it != trendVars.end(); it++) eval_context[*it] = 2; //not <= 0 bc of log, not 1 bc of powers } + +bool +DynamicModel::isModelLocalVariableUsed() const +{ + set<int> used_local_vars; + size_t i = 0; + while (i < equations.size() && used_local_vars.size() == 0) + { + equations[i]->collectModelLocalVariables(used_local_vars); + i++; + } + return used_local_vars.size() > 0; +} diff --git a/preprocessor/DynamicModel.hh b/preprocessor/DynamicModel.hh index 673ed862ffc65be3206bed5b2ffd3f304116edcd..d95deae894848c7af0c3542ca0dd6acb7890197e 100644 --- a/preprocessor/DynamicModel.hh +++ b/preprocessor/DynamicModel.hh @@ -476,6 +476,7 @@ public: else return (-1); }; + bool isModelLocalVariableUsed() const; }; #endif diff --git a/preprocessor/ModFile.cc b/preprocessor/ModFile.cc index c28f7d35acb8948f42a219827b77362a19cd94dd..e9bce2212a4bf330533fcb151243eb9476314452 100644 --- a/preprocessor/ModFile.cc +++ b/preprocessor/ModFile.cc @@ -163,6 +163,13 @@ ModFile::checkPass() exit(EXIT_FAILURE); } + if (block || byte_code) + if (dynamic_model.isModelLocalVariableUsed()) + { + cerr << "ERROR: In 'model' block, 'block' or 'bytecode' options are not yet compatible with pound expressions" << endl; + exit(EXIT_FAILURE); + } + if ((stochastic_statement_present || mod_file_struct.check_present || mod_file_struct.steady_present) && no_static) { cerr << "ERROR: no_static option is incompatible with stoch_simul, estimation, osr, ramsey_policy, discretionary_policy, steady and check commands" << endl;