How to use struct member in cross coverage bin select expression

I have a covergroup with sample function taking a struct as input, and I’m trying to create cross coverage based on one of the struct’s members. I’m able to create a single coverpoint based on one of the struct’s members, but when creating the cross coverage bins, I’m unable to use binsof(.), I get a compiler error. I have a sample code snippet below showing what I’m trying to do.

typedef struct packed {
  logic valid;
} my_s;

covergroup cg with function sample(bit a, my_s b);
  b_cp : coverpoint b.valid; //Works just fine
  cross_cp : cross a, b.valid iff(a == 1'b1) {
    ignore_bins ig = binsof(b.valid) intersect {1'b1};
  }
endgroup

I get a compiler error along the lines of “unable to find coverpoint named b” and I believe it’s because the compiler thinks the “b.valid” is referring to a coverpoint named ‘b’ with bin named ‘valid’, but it’s actually referring to a struct variable named ‘b’ with member named ‘valid’.

From my reading of the SystemVerilog LRM, I believe this should be acceptable syntax, can somebody help tell me if this is not acceptable or if it’s an issue with my compiler?

In reply to marver22:

The BNF for a cross_item only allows simple identifiers, not a select expression. You can simply use b_cp instead.