From 5498ce98eefb8ed226552f1c24bd829e52a2af42 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Fri, 16 Jul 2021 12:08:18 +0200
Subject: [PATCH] Use NumConstNode* type for DataTree constants (previously
 they were just expr_t)

---
 src/DataTree.cc | 2 +-
 src/DataTree.hh | 5 +++--
 src/ModFile.cc  | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/DataTree.cc b/src/DataTree.cc
index 4fb897fd..f24c3030 100644
--- a/src/DataTree.cc
+++ b/src/DataTree.cc
@@ -119,7 +119,7 @@ DataTree::operator=(const DataTree &d)
   return *this;
 }
 
-expr_t
+NumConstNode *
 DataTree::AddNonNegativeConstant(const string &value)
 {
   int id = num_constants.AddNonNegativeConstant(value);
diff --git a/src/DataTree.hh b/src/DataTree.hh
index 0b6e6b00..62da5681 100644
--- a/src/DataTree.hh
+++ b/src/DataTree.hh
@@ -140,7 +140,8 @@ public:
   DataTree &operator=(DataTree &&) = delete;
 
   //! Some predefined constants
-  expr_t Zero, One, Two, Three, MinusOne, NaN, Infinity, MinusInfinity, Pi;
+  NumConstNode *Zero, *One, *Two, *Three, *NaN, *Infinity, *Pi;
+  expr_t MinusOne, MinusInfinity;
 
   //! Raised when a local parameter is declared twice
   class LocalVariableException
@@ -158,7 +159,7 @@ public:
 
   inline expr_t AddPossiblyNegativeConstant(double val);
   //! Adds a non-negative numerical constant (possibly Inf or NaN)
-  expr_t AddNonNegativeConstant(const string &value);
+  NumConstNode *AddNonNegativeConstant(const string &value);
   //! Adds a variable
   VariableNode *AddVariable(int symb_id, int lag = 0);
   //! Gets a variable
diff --git a/src/ModFile.cc b/src/ModFile.cc
index 2892fbfc..6346c820 100644
--- a/src/ModFile.cc
+++ b/src/ModFile.cc
@@ -578,7 +578,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, bool
 
       /* Create auxiliary parameters and the expression to be substituted into
          the var_expectations statement */
-      auto subst_expr = dynamic_model.Zero;
+      expr_t subst_expr = dynamic_model.Zero;
       for (int lag = 0; lag < max_lag; lag++)
         for (auto variable : lhs)
           {
-- 
GitLab