diff --git a/src/macro/Directives.cc b/src/macro/Directives.cc index d12a0f297cb90bccffa41032847e2a01fff6a1b0..dde0b377a1f0a179ff6614161b0cdc59d9828bc0 100644 --- a/src/macro/Directives.cc +++ b/src/macro/Directives.cc @@ -1,5 +1,5 @@ /* - * Copyright © 2019-2020 Dynare Team + * Copyright © 2019-2021 Dynare Team * * This file is part of Dynare. * @@ -253,7 +253,9 @@ If::interpret(ostream &output, vector<filesystem::path> &paths) { first_clause = false; VariablePtr vp = dynamic_pointer_cast<Variable>(expr); - assert(vp); + if (!vp) + error(StackTrace(ifdef ? "@#ifdef" : "@ifndef", + "The condition must be a variable name", location)); if ((ifdef && env.isVariableDefined(vp->getName())) || (ifndef && !env.isVariableDefined(vp->getName()))) {