From 0d6eb053d4b0ec09c2308311d0c6fb581e83337f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 21 Jul 2021 14:37:34 +0200
Subject: [PATCH] =?UTF-8?q?Ensure=20that=20=E2=80=9Cpac=5Fexpectation?=
 =?UTF-8?q?=E2=80=9D=20operators=20are=20never=20inserted=20into=20a=20sta?=
 =?UTF-8?q?tic=20model?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The implementation of PacExpectationNode::toStatic() did not make sense. It
should normally never be called, hence we error out at this point.

Also do a cosmetic change in the PacExpectationNode::clone() methode.
---
 src/ExprNode.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/ExprNode.cc b/src/ExprNode.cc
index cc8185c5..15b83a41 100644
--- a/src/ExprNode.cc
+++ b/src/ExprNode.cc
@@ -8324,13 +8324,14 @@ PacExpectationNode::computeBlockTemporaryTerms(int blk, int eq, vector<vector<te
 expr_t
 PacExpectationNode::toStatic(DataTree &static_datatree) const
 {
-  return static_datatree.AddPacExpectation(string(model_name));
+  cerr << "PacExpectationNode::toStatic not implemented." << endl;
+  exit(EXIT_FAILURE);
 }
 
 expr_t
 PacExpectationNode::clone(DataTree &datatree) const
 {
-  return datatree.AddPacExpectation(string(model_name));
+  return datatree.AddPacExpectation(model_name);
 }
 
 void
-- 
GitLab