Add regression tests for returning class objects from functions

Check that returning class objects from functions is supported.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-09-18 14:31:03 +02:00
parent 1fd968773e
commit d4c662c6a1
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,29 @@
// Check that functions returning a class object are supported
module test;
class C;
int i;
task t;
if (i == 10) begin
$display("PASSED");
end else begin
$display("FAILED");
end
endtask
endclass
function C f;
C c;
c = new;
c.i = 10;
return c;
endfunction
initial begin
C c;
c = f();
c.t;
end
endmodule

View File

@ -532,6 +532,7 @@ sv_class_property_signed1 normal,-g2009 ivltests
sv_class_property_signed2 normal,-g2009 ivltests
sv_class_property_signed3 normal,-g2009 ivltests
sv_class_property_signed4 normal,-g2009 ivltests
sv_class_return normal,-g2009 ivltests
sv_class_static_prop1 normal,-g2009 ivltests
sv_class_static_prop2 normal,-g2009 ivltests
sv_class_static_prop3 normal,-g2009 ivltests