Structures in sample function

I have a covergroup with sample function. Argument to the sample function is a struct.

covergroup cg_mem (string name)with function sample(ref st_cov); = name;
  option.per_instance = 1;

cp_port_fltr : coverpoint `REG.PORT iff(st_cov.port_count !=0){
 bins b_en = {1'b1};
 bins b_dis = {1'b0};

Is it not allowed to use structures? I get error:
Member operator “.” cannot be used on object of type reg.

In reply to kartavya:

You did not declare st_cov as a struct or provide any datatype. Since you did not provide a data type, SystemVerilog bluntly provides an implicit reg/logic datatype for you.

Replace ref with the actual struct data type.