diff --git a/ivtest/gold/sv_class_method_call_nonvoid-iverilog-stderr.gold b/ivtest/gold/sv_class_method_call_nonvoid-iverilog-stderr.gold new file mode 100644 index 000000000..c85d9fc05 --- /dev/null +++ b/ivtest/gold/sv_class_method_call_nonvoid-iverilog-stderr.gold @@ -0,0 +1 @@ +ivltests/sv_class_method_call_nonvoid.v:14: warning: User function 'value' is being called as a task. diff --git a/ivtest/gold/sv_class_method_call_nonvoid-vvp-stdout.gold b/ivtest/gold/sv_class_method_call_nonvoid-vvp-stdout.gold new file mode 100644 index 000000000..53cdf1e93 --- /dev/null +++ b/ivtest/gold/sv_class_method_call_nonvoid-vvp-stdout.gold @@ -0,0 +1 @@ +PASSED diff --git a/ivtest/ivltests/sv_class_method_call_nonvoid.v b/ivtest/ivltests/sv_class_method_call_nonvoid.v new file mode 100644 index 000000000..159cca507 --- /dev/null +++ b/ivtest/ivltests/sv_class_method_call_nonvoid.v @@ -0,0 +1,32 @@ +// Check that a bare inherited non-void function can be called as a statement. + +class B; + int calls; + + function int value(); + calls = calls + 1; + return calls; + endfunction +endclass + +class C extends B; + function void run(); + value(); + endfunction +endclass + +module test; + C object; + + initial begin + object = new; + object.calls = 0; + object.run(); + + if (object.calls !== 1) begin + $display("FAILED: expected one call, got %0d", object.calls); + end else begin + $display("PASSED"); + end + end +endmodule diff --git a/ivtest/regress-vvp.list b/ivtest/regress-vvp.list index daed884c7..19bbe7abd 100644 --- a/ivtest/regress-vvp.list +++ b/ivtest/regress-vvp.list @@ -290,6 +290,7 @@ sv_class_const_nested_block vvp_tests/sv_class_const_nested_block.json sv_class_const_static_assign_fail vvp_tests/sv_class_const_static_assign_fail.json sv_class_const_static_init vvp_tests/sv_class_const_static_init.json sv_class_const_static_local_fail vvp_tests/sv_class_const_static_local_fail.json +sv_class_method_call_nonvoid vvp_tests/sv_class_method_call_nonvoid.json sv_class_nested_method_call vvp_tests/sv_class_nested_method_call.json sv_class_prop_assign_op1 vvp_tests/sv_class_prop_assign_op1.json sv_class_prop_assign_op2 vvp_tests/sv_class_prop_assign_op2.json diff --git a/ivtest/vvp_tests/sv_class_method_call_nonvoid.json b/ivtest/vvp_tests/sv_class_method_call_nonvoid.json new file mode 100644 index 000000000..1b2424674 --- /dev/null +++ b/ivtest/vvp_tests/sv_class_method_call_nonvoid.json @@ -0,0 +1,11 @@ +{ + "type" : "normal", + "source" : "sv_class_method_call_nonvoid.v", + "iverilog-args" : [ "-g2005-sv" ], + "gold" : "sv_class_method_call_nonvoid", + "vlog95" : { + "__comment" : "Classes are not supported", + "type" : "CE", + "gold" : "" + } +}