From ce8ee4261906c1967fa41ead1d19ada6ee3b6815 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 18 Feb 2022 11:01:29 +0100 Subject: [PATCH] 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 --- ivtest/ivltests/sv_class_new_init.v | 29 +++++++++++++++++++++++++++++ ivtest/regress-sv.list | 1 + ivtest/regress-vlog95.list | 1 + 3 files changed, 31 insertions(+) create mode 100644 ivtest/ivltests/sv_class_new_init.v diff --git a/ivtest/ivltests/sv_class_new_init.v b/ivtest/ivltests/sv_class_new_init.v new file mode 100644 index 000000000..7ff5cbb0f --- /dev/null +++ b/ivtest/ivltests/sv_class_new_init.v @@ -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 diff --git a/ivtest/regress-sv.list b/ivtest/regress-sv.list index b0e865eb5..b16e8b7fe 100644 --- a/ivtest/regress-sv.list +++ b/ivtest/regress-sv.list @@ -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 diff --git a/ivtest/regress-vlog95.list b/ivtest/regress-vlog95.list index 069831104..1c66d40f6 100644 --- a/ivtest/regress-vlog95.list +++ b/ivtest/regress-vlog95.list @@ -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