diff --git a/src/macro/Directives.cc b/src/macro/Directives.cc
index 245c6fc2059ae5550faa7cd70d3502af034b59d9..64fa4854b343829364113708c1a25983d67e5005 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;