Can an array element be passed as ref argument to task

Hi,

I have an associative array of data_class. Can I passed array index object to the ref argument of a task.

Below is the code:

my_data_class tx_packet[int];
.
.
.
task drive(ref my_data_class pkt);
begin…

end
endtask : drive

…Somewhere in my driver I am calling as

for(int i =0; i < tx_packet.size; i++)
drive(tx_packet[i]);

I get compilation error for Cadence IUS as " invalid ref argument usage because actual argument is not a variable. " No compilation error comes for Questa.

In IEEE 1800-2012, section 13.5.2 Pass by reference lists “An element of an unpacked array” as being legal to be passed by reference. An associative array is one kind of unpacked array. (7.4 Packed and unpacked arrays)

In reply to dave_59:

Thanks Dave for your reply.

Agree to your point, no compilation error comes for QUESTA or VCS, but I get the above mentioned error for IUS. So I think it might be Simulator issue.