Add regression test for class tasks used as expressions

Check that using a class task through an object method call in expression
context reports a compile/elaboration error instead of triggering an assert.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2026-06-20 16:12:45 -07:00
parent 0637afd284
commit 449abb6bda
3 changed files with 29 additions and 0 deletions

View File

@ -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

View File

@ -272,6 +272,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

View File

@ -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"
}
}