diff --git a/frontends/p4/typeChecking/typeChecker.cpp b/frontends/p4/typeChecking/typeChecker.cpp index cdbd1b2ef1b..197d3cb1841 100644 --- a/frontends/p4/typeChecking/typeChecker.cpp +++ b/frontends/p4/typeChecking/typeChecker.cpp @@ -3183,7 +3183,7 @@ const IR::Node* TypeInference::postorder(IR::MethodCallExpression* expression) { checkCorelibMethods(mi->to()); auto bi = mi->to(); - if ((findContext() || findContext()) && + if ((findContext()) && (!bi || (bi->name == IR::Type_Stack::pop_front || bi->name == IR::Type_Stack::push_front))) { typeError("%1%: no function calls allowed in this context", expression);