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 <lars@metafoo.de>
This commit is contained in:
parent
593a97bede
commit
0637afd284
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue