Systemverilog interface definition - lint error message
class class_onehot_to_binary

# (parameter WIDTH_ONEHOT=16);

localparam WIDTH_BINARY = $clog2 (WIDTH_ONEHOT) ;
    static function logic [WIDTH_BINARY-1:0] onehot_to_binary
    (logic [WIDTH_ONEHOT-1: 0] onehot);
    logic [WIDTH_BINARY-1:0] binary=0;
        foreach (onehot[index])
        begin
            if (onehot[index]==1'b1) begin
                binary=binary|index;
            end
        end
        return binary;
    endfunction

endclass

Note that even though onehot_to_binary has a static class qualifier, the function has an automatic lifetime.
You would call this using class_onehot_to_binary#(32)::onehot_to_binary(value)