From 748d6d8de2b468163c51aa7d64dddcf38e133f5d Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 21 Dec 2022 19:00:14 -0800 Subject: [PATCH] Add regression tests for class methods with static lifetime Check that trying to specify a class method with static lifetime results in an error. Signed-off-by: Lars-Peter Clausen --- ivtest/ivltests/sv_class_method_lt_static1.v | 18 ++++++++++++++++++ ivtest/ivltests/sv_class_method_lt_static2.v | 19 +++++++++++++++++++ ivtest/regress-sv.list | 2 ++ 3 files changed, 39 insertions(+) create mode 100644 ivtest/ivltests/sv_class_method_lt_static1.v create mode 100644 ivtest/ivltests/sv_class_method_lt_static2.v diff --git a/ivtest/ivltests/sv_class_method_lt_static1.v b/ivtest/ivltests/sv_class_method_lt_static1.v new file mode 100644 index 000000000..73bdb65bc --- /dev/null +++ b/ivtest/ivltests/sv_class_method_lt_static1.v @@ -0,0 +1,18 @@ +// Check that specifing static lifetime for a class method taks results in an +// error. + +module test; + + class C; + // This should fail, all class methods have automatic lifetime + task static t(int x); + int y; + y = 2 * x; + endtask + endclass + + initial begin + $display("FAILED"); + end + +endmodule diff --git a/ivtest/ivltests/sv_class_method_lt_static2.v b/ivtest/ivltests/sv_class_method_lt_static2.v new file mode 100644 index 000000000..762747642 --- /dev/null +++ b/ivtest/ivltests/sv_class_method_lt_static2.v @@ -0,0 +1,19 @@ +// Check that specifing static lifetime for a class method function results in +// an error. + +module test; + + class C; + // This should fail, all class methods have automatic lifetime + function static int t(int x); + int y; + y = 2 * x; + return y; + endfunction + endclass + + initial begin + $display("FAILED"); + end + +endmodule diff --git a/ivtest/regress-sv.list b/ivtest/regress-sv.list index 060e06281..a87c17491 100644 --- a/ivtest/regress-sv.list +++ b/ivtest/regress-sv.list @@ -565,6 +565,8 @@ sv_class_in_module_decl normal,-g2009 ivltests sv_class_method_call_void normal,-g2009 ivltests sv_class_method_default1 normal,-g2009 ivltests sv_class_method_default2 normal,-g2009 ivltests +sv_class_method_lt_static1 CE,-g2009 ivltests +sv_class_method_lt_static2 CE,-g2009 ivltests sv_class_method_signed1 normal,-g2009 ivltests sv_class_method_signed2 normal,-g2009 ivltests sv_class_method_var_init normal,-g2009 ivltests