Can a function return unpacked arrays like queue/Dynamic arrays?

In reply to dave_59:

I did this but an error says “inappropriate use of bit select” pointing to chk_data_error[i].
This is my code:


typedef bit data_error[];

virtual protected function data_error chk_data_error (int unsigned bc, bit [8:0] data_bit_err[]);
  this.chk_data_error = new[bc];
  for(int i=0; i<bc; i++) begin
    this.chk_data_error[i] = |data_bit_err[i];
  end
endfunction : chk_data_error