From c45f45f58ed144ede58211614101ba763fdbf785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Tue, 13 May 2014 11:46:19 +0200 Subject: [PATCH] Forbid model local variables in planner_objective. Otherwise the preprocessor crashes. --- preprocessor/ParsingDriver.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/preprocessor/ParsingDriver.cc b/preprocessor/ParsingDriver.cc index 70ebe8712..517b0d882 100644 --- a/preprocessor/ParsingDriver.cc +++ b/preprocessor/ParsingDriver.cc @@ -323,6 +323,9 @@ ParsingDriver::add_model_variable(int symb_id, int lag) if (dynamic_cast(model_tree) != NULL && lag != 0) error("Leads and lags on variables are forbidden in 'planner_objective'."); + if (dynamic_cast(model_tree) != NULL && type == eModelLocalVariable) + error("Model local variable " + mod_file->symbol_table.getName(symb_id) + " cannot be used in 'planner_objective'."); + // It makes sense to allow a lead/lag on parameters: during steady state calibration, endogenous and parameters can be swapped return model_tree->AddVariable(symb_id, lag); }