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 <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-12-15 20:49:16 -08:00
parent d426e80c73
commit fa4c67ccf7
4 changed files with 30 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.