Add regression test for class new initializer

Check that it is possible to use a class new as
an initializer for a variable or property declaration.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-02-18 11:01:29 +01:00
parent f6394c5fe6
commit ce8ee42619
3 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,29 @@
// Check that the class new initializer can be used for all sorts for variable
// declarations
package P;
class C;
endclass
C c = new;
endpackage
module test;
class C;
task check;
$display("PASSED");
endtask
endclass
class D;
C c = new;
endclass
C c = new;
initial begin
static C c = new;
c.check();
end
endmodule

View File

@ -433,6 +433,7 @@ sv_class22 normal,-g2009 ivltests
sv_class23 normal,-g2009 ivltests
sv_class24 normal,-g2009 ivltests
sv_class_extends_scoped normal,-g2009 ivltests
sv_class_new_init normal,-g2009 ivltests
sv_darray1 normal,-g2009 ivltests
sv_darray2 normal,-g2009 ivltests
sv_darray3 normal,-g2009 ivltests

View File

@ -364,6 +364,7 @@ sv_class22 CE,-g2009 ivltests
sv_class23 CE,-g2009 ivltests
sv_class24 CE,-g2009 ivltests
sv_class_extends_scoped CE,-g2009 ivltests
sv_class_new_init CE,-g2009 ivltests
sv_end_label CE,-g2009 ivltests # Also generate
sv_foreach2 CE,-g2009,-pallowsigned=1 ivltests
sv_foreach3 CE,-g2009 ivltests