Add regression test for inherited non-void function calls
Check that a bare inherited non-void function call used as a statement emits the required discarded-return warning and executes the function. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
d1e0fa7da0
commit
72998c5415
|
|
@ -0,0 +1 @@
|
|||
ivltests/sv_class_method_call_nonvoid.v:14: warning: User function 'value' is being called as a task.
|
||||
|
|
@ -0,0 +1 @@
|
|||
PASSED
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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" : ""
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue