diff --git a/elab_expr.cc b/elab_expr.cc index acd599a25..0c9c330aa 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -1642,6 +1642,9 @@ unsigned PECallFunction::test_width(Design*des, NetScope*scope, return 0; } + if (def->is_void()) + return 0; + NetScope*dscope = def->scope(); assert(dscope); @@ -2860,6 +2863,14 @@ NetExpr* PECallFunction::elaborate_base_(Design*des, NetScope*scope, NetScope*ds if (parm_errors) return 0; + if (def->is_void()) { + cerr << get_fileline() << ": error: void function `" + << dscope->basename() << "` can not be called in an expression." + << endl; + des->errors++; + return nullptr; + } + /* Look for the return value signal for the called function. This return value is a magic signal in the scope of the function, that has the name of the function. The