From 0637afd2849cc9b93dd9be43032c6a05f5cc9bf1 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sat, 20 Jun 2026 16:12:28 -0700 Subject: [PATCH] Report error for class tasks used as expressions Class object method calls in expression context call func_def() without first checking that the resolved class method is a function. If the method is a task, func_def() triggers an assert instead of reporting a normal elaboration error. Check the method scope type before accessing the function definition and report an error for tasks. Signed-off-by: Lars-Peter Clausen --- elab_expr.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/elab_expr.cc b/elab_expr.cc index 604e8d99d..526119758 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -3410,6 +3410,14 @@ NetExpr* PECallFunction::elaborate_expr_method_(Design*des, NetScope*scope, return 0; } + if (method->type() != NetScope::FUNC) { + cerr << get_fileline() << ": error: Method " << method_name + << " of class " << class_type->get_name() + << " is not a function." << endl; + des->errors++; + return nullptr; + } + const NetFuncDef*def = method->func_def(); ivl_assert(*this, def);