From fa4c67ccf74075bc79ef467c0b54ec894af12f5d Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Thu, 15 Dec 2022 20:49:16 -0800 Subject: [PATCH] Add regression tests for tasks and void function calls in expression Check that an error is reported when either calling a task or a void function as part of an expression. Signed-off-by: Lars-Peter Clausen --- ivtest/ivltests/func_void_in_expr_fail.v | 14 ++++++++++++++ ivtest/ivltests/task_in_expr_fail.v | 14 ++++++++++++++ ivtest/regress-sv.list | 1 + ivtest/regress-vlg.list | 1 + 4 files changed, 30 insertions(+) create mode 100644 ivtest/ivltests/func_void_in_expr_fail.v create mode 100644 ivtest/ivltests/task_in_expr_fail.v diff --git a/ivtest/ivltests/func_void_in_expr_fail.v b/ivtest/ivltests/func_void_in_expr_fail.v new file mode 100644 index 000000000..8b065f2e7 --- /dev/null +++ b/ivtest/ivltests/func_void_in_expr_fail.v @@ -0,0 +1,14 @@ +// Check that an error is reported when a void function is used in an expression + +module test; + + function void f; + endfunction + + initial begin + int x; + x = f() + 1; // This should fail, void function can not be used in expression + $display("FAILED"); + end + +endmodule diff --git a/ivtest/ivltests/task_in_expr_fail.v b/ivtest/ivltests/task_in_expr_fail.v new file mode 100644 index 000000000..4ff3e8ff0 --- /dev/null +++ b/ivtest/ivltests/task_in_expr_fail.v @@ -0,0 +1,14 @@ +// Check that an error is reported when a task is used in an expression + +module test; + + task t; + endtask + + initial begin + int x; + x = t() + 1; // This should fail, task can not be used in expression + $display("FAILED"); + end + +endmodule diff --git a/ivtest/regress-sv.list b/ivtest/regress-sv.list index e9f4a5ad2..ba3ceb040 100644 --- a/ivtest/regress-sv.list +++ b/ivtest/regress-sv.list @@ -312,6 +312,7 @@ fr49 normal,-g2009 ivltests func_init_var1 normal,-g2009 ivltests func_init_var2 normal,-g2009 ivltests func_init_var3 normal,-g2009 ivltests +func_void_in_expr_fail CE,-g2005-sv ivltests function10 CO,-g2005-sv ivltests function11 CE,-g2005-sv ivltests function12 normal,-g2005-sv ivltests gold=function12.gold diff --git a/ivtest/regress-vlg.list b/ivtest/regress-vlg.list index c6c70a513..57f82c2e2 100644 --- a/ivtest/regress-vlg.list +++ b/ivtest/regress-vlg.list @@ -1650,6 +1650,7 @@ task3.14D normal ivltests task3.14E normal ivltests task3.14F normal ivltests task_bypath normal ivltests # task enabled by complete path name. +task_in_expr_fail CE ivltests task_inpad normal ivltests # Validates input of task should pad w/ 0 task_iotypes normal ivltests # task ports with types. task_iotypes2 normal ivltests # task ports with types.