From 569ba887b374cec71169ee2773c3e569f0745da9 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 13 Dec 2022 21:27:09 -0800 Subject: [PATCH] Add regression test for creating instances of virtual classes Check that an error is reported when trying to create an object of a virtual class. Signed-off-by: Lars-Peter Clausen --- ivtest/ivltests/sv_class_virt_new_fail.v | 15 +++++++++++++++ ivtest/regress-sv.list | 1 + 2 files changed, 16 insertions(+) create mode 100644 ivtest/ivltests/sv_class_virt_new_fail.v diff --git a/ivtest/ivltests/sv_class_virt_new_fail.v b/ivtest/ivltests/sv_class_virt_new_fail.v new file mode 100644 index 000000000..8a5724594 --- /dev/null +++ b/ivtest/ivltests/sv_class_virt_new_fail.v @@ -0,0 +1,15 @@ +// Check that an error is reported when trying to create an object of a virtual +// class. + +module test; + + virtual class C; + endclass + + C c; + + initial begin + c = new; // This should fail + end + +endmodule diff --git a/ivtest/regress-sv.list b/ivtest/regress-sv.list index e9f4a5ad2..84c2b5642 100644 --- a/ivtest/regress-sv.list +++ b/ivtest/regress-sv.list @@ -554,6 +554,7 @@ sv_class_static_prop3 normal,-g2009 ivltests sv_class_super1 normal,-g2009 ivltests sv_class_super2 normal,-g2009 ivltests sv_class_task1 normal,-g2009 ivltests +sv_class_virt_new_fail CE,-g2009 ivltests sv_darray1 normal,-g2009 ivltests sv_darray2 normal,-g2009 ivltests sv_darray3 normal,-g2009 ivltests