diff --git a/ivtest/ivltests/sv_class_const_derived.v b/ivtest/ivltests/sv_class_const_derived.v new file mode 100644 index 000000000..41c47b765 --- /dev/null +++ b/ivtest/ivltests/sv_class_const_derived.v @@ -0,0 +1,29 @@ +// Check const property initialization in a derived class. + +module test; + + class Base; + int inherited; + endclass + + class Derived extends Base; + const int value; + + function new; + value = 42; + endfunction + endclass + + Derived object; + + initial begin + object = new; + + if (object.value !== 42) begin + $display("FAILED: expected 42, got %0d", object.value); + end else begin + $display("PASSED"); + end + end + +endmodule diff --git a/ivtest/regress-vvp.list b/ivtest/regress-vvp.list index 5453cb1ca..9d338fd9b 100644 --- a/ivtest/regress-vvp.list +++ b/ivtest/regress-vvp.list @@ -285,6 +285,7 @@ sv_chained_constructor2 vvp_tests/sv_chained_constructor2.json sv_chained_constructor3 vvp_tests/sv_chained_constructor3.json sv_chained_constructor4 vvp_tests/sv_chained_constructor4.json sv_chained_constructor5 vvp_tests/sv_chained_constructor5.json +sv_class_const_derived vvp_tests/sv_class_const_derived.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 diff --git a/ivtest/vvp_tests/sv_class_const_derived.json b/ivtest/vvp_tests/sv_class_const_derived.json new file mode 100644 index 000000000..8ce6acca9 --- /dev/null +++ b/ivtest/vvp_tests/sv_class_const_derived.json @@ -0,0 +1,9 @@ +{ + "type" : "normal", + "source" : "sv_class_const_derived.v", + "iverilog-args" : [ "-g2005-sv" ], + "vlog95" : { + "__comment" : "Classes are not supported", + "type" : "CE" + } +}