From df8d8ef116a5d362f40e9d5328a2bd571faa8c95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Mon, 2 Nov 2020 12:27:27 +0100
Subject: [PATCH] Fix logic for @#ifndef

Ref. dynare#1747
---
 src/macro/Directives.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/macro/Directives.cc b/src/macro/Directives.cc
index b40e2353..7a89e45a 100644
--- a/src/macro/Directives.cc
+++ b/src/macro/Directives.cc
@@ -306,8 +306,8 @@ Ifndef::interpret(ostream &output, vector<filesystem::path> &paths)
 {
   for (const auto & [expr, body] : expr_and_body)
     if (VariablePtr vp = dynamic_pointer_cast<Variable>(expr);
-        !(dynamic_pointer_cast<BaseType>(expr)
-          || (vp && env.isVariableDefined(vp->getName()))))
+        dynamic_pointer_cast<BaseType>(expr)
+        || (vp && !env.isVariableDefined(vp->getName())))
       {
         interpretBody(body, output, paths);
         break;
-- 
GitLab