From c77933646817f5f12becaab33003f7f3ec68a379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Mon, 3 Feb 2014 16:22:42 +0100 Subject: [PATCH] Exit gracefully if an external function name is used as a model local variable. Closes #599 (cherry picked from commit 535af2d536bda159d3b3820b77e94c9f07ceaf88) --- preprocessor/ParsingDriver.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/preprocessor/ParsingDriver.cc b/preprocessor/ParsingDriver.cc index ddaff0275..5e519491b 100644 --- a/preprocessor/ParsingDriver.cc +++ b/preprocessor/ParsingDriver.cc @@ -342,6 +342,9 @@ ParsingDriver::add_expression_variable(string *name) || mod_file->symbol_table.getType(*name) == eLogTrend) error("Variable " + *name + " not allowed outside model declaration, because it is a trend variable."); + if (mod_file->symbol_table.getType(*name) == eExternalFunction) + error("Symbol '" + *name + "' is the name of a MATLAB/Octave function, and cannot be used as a variable."); + int symb_id = mod_file->symbol_table.getID(*name); expr_t id = data_tree->AddVariable(symb_id); -- GitLab