Dynare++: prevent repeated assignment of a parameter/variable

This is not correctly handled by the evaluator.

Closes #415
time-shift
Sébastien Villemot 2013-08-27 15:16:49 +02:00
parent e1fbb2c5cd
commit 77dd7239b5
1 changed files with 5 additions and 0 deletions

View File

@ -119,6 +119,11 @@ void AtomAssignings::add_assignment(int asgn_off, const char* str, int name_len,
// register name of the left hand side and put to lname2expr
const char* ss = left_names.insert(buf);
if (lname2expr.find(ss) != lname2expr.end()) {
// Prevent the occurrence of #415
std::cerr << "Changing the value of " << ss << " is not supported. Aborting." << std::endl;
exit(EXIT_FAILURE);
}
lname2expr[ss] = order.size()-1;
// delete name