In reply to verif_learner:
There are many more restrictions when using pass by reference direction. The formal and actual argument types must match exactly. A fixed sized array is not the same type as a dynamic array. Another restriction your tool did not catch is you can only use pass by reference with functions/tasks that have an automatic lifetime. See this link.
Also, you are declaring your function without an explicit return type. The Verilog implicit default is 1-bit return value. Use ‘function void’