Files
iverilog/ivtest/ivltests/func_empty_arg_fail1.v
T
Lars-Peter Clausen fe5e60840f Add regression test for function calls with empty arguments
Check that function calls with empty arguments are supported. Check the
general case and special cases such as calling a function with empty
arguments as part of a module port binding or force statements in automatic
contexts.

Also check that calling a function with too many trailing empty arguments
as well as passing an empty argument for a port without a default value is
an error.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2023-01-16 08:07:03 -08:00

17 lines
399 B
Verilog

// Check that passing too many empty arguments to a function results in an error.
module test;
function f(integer a = 1, integer b = 2, integer c = 3);
return a + 10 * b + 100 * c;
endfunction
initial begin
integer x;
x = f( , , ,); // This should fail. 4 empty args, even though the function
// only takes 3 args
$display("FAILED");
end
endmodule