From ec66768a636610ecdb0b5f1db9f41aa2c15e52a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Fri, 22 Jan 2021 11:59:44 +0100
Subject: [PATCH] Forbid exogenous deterministic variables with a lead or lag

Ref. dynare#1765
---
 src/ParsingDriver.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/ParsingDriver.cc b/src/ParsingDriver.cc
index b2a4085f..aadae940 100644
--- a/src/ParsingDriver.cc
+++ b/src/ParsingDriver.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2003-2020 Dynare Team
+ * Copyright © 2003-2021 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -398,6 +398,10 @@ ParsingDriver::add_model_variable(int symb_id, int lag)
     error("Symbol " + mod_file->symbol_table.getName(symb_id)
           +" is a function name external to Dynare. It cannot be used like a variable without input argument inside model.");
 
+  // See dynare#1765
+  if (type == SymbolType::exogenousDet && lag != 0)
+    error("Exogenous deterministic variable " + mod_file->symbol_table.getName(symb_id) + " cannot be given a lead or a lag.");
+
   if (type == SymbolType::modelLocalVariable && lag != 0)
     error("Model local variable " + mod_file->symbol_table.getName(symb_id) + " cannot be given a lead or a lag.");
 
-- 
GitLab