From fec807ea172f4f07b7ca9024c9fced81f807df73 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?=
 <stepan@dynare.org>
Date: Tue, 18 Jun 2019 09:13:31 +0200
Subject: [PATCH] Test if leaded variables exists when calling
 simul_backward_model routine.

---
 matlab/backward/simul_backward_model.m | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/matlab/backward/simul_backward_model.m b/matlab/backward/simul_backward_model.m
index e533ae627a..ab1aedcf78 100644
--- a/matlab/backward/simul_backward_model.m
+++ b/matlab/backward/simul_backward_model.m
@@ -18,7 +18,7 @@ function simulation = simul_backward_model(initialconditions, samplesize, innova
 % [3] If the first input argument is empty, the endogenous variables are initialized with 0, or if available with the informations
 %     provided thrtough the histval block.
 
-% Copyright (C) 2012-2018 Dynare Team
+% Copyright (C) 2012-2019 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -37,6 +37,10 @@ function simulation = simul_backward_model(initialconditions, samplesize, innova
 
 global options_ M_ oo_
 
+if M_.maximum_lead
+    error('Model defined in %s.mod is not backward or static.', M_.fname)
+end
+
 if nargin<3
     Innovations = [];
 else
-- 
GitLab