diff --git a/src/macro/Directives.cc b/src/macro/Directives.cc
index b40e23531953116948e035a2a6aab4e60227156d..7a89e45a0532450d31b6ec0621d3149cddbd1898 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;