Merge pull request #1394 from larsclausen/class-task-method-expression-error
Report error for class tasks used as expressions
This commit is contained in:
commit
daadc38f18
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
// Check that using a class task as an expression reports an error.
|
||||
|
||||
module test;
|
||||
|
||||
class C;
|
||||
task t;
|
||||
endtask
|
||||
endclass
|
||||
|
||||
C c;
|
||||
|
||||
initial begin
|
||||
int x;
|
||||
c = new;
|
||||
x = c.t();
|
||||
$display("FAILED");
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -276,6 +276,7 @@ sv_class_prop_nest_obj1 vvp_tests/sv_class_prop_nest_obj1.json
|
|||
sv_class_prop_nest_real1 vvp_tests/sv_class_prop_nest_real1.json
|
||||
sv_class_prop_nest_str1 vvp_tests/sv_class_prop_nest_str1.json
|
||||
sv_class_prop_nest_vec1 vvp_tests/sv_class_prop_nest_vec1.json
|
||||
sv_class_task_expr_fail vvp_tests/sv_class_task_expr_fail.json
|
||||
sv_const1 vvp_tests/sv_const1.json
|
||||
sv_const2 vvp_tests/sv_const2.json
|
||||
sv_const3 vvp_tests/sv_const3.json
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_class_task_expr_fail.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ],
|
||||
"vlog95" : {
|
||||
"__comment" : "Classes are not supported",
|
||||
"type" : "CE"
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue