Constraining a union of enums

In reply to dave_59:

The packed union containing enums is part of an interface struct, we ran into this issue while randomizing input values.

I looked at 2017 LRM and found this section. Is this the clarification you referred to?

If a rand variable of packed structure or packed untagged union type has a member of enum type,
the rules in 18.3 restricting the random values of an enum variable shall not apply to that member.
For example:


typedef enum bit [1:0] { A=2'b00, B=2'b11 } ab_e;
typedef struct packed {
ab_e ValidAB;
} VStructEnum;
typedef union packed {
ab_e ValidAB;
} VUnionEnum;

When randomizing a variable of type ab_e, the solver can only select a random value of 2’b00 or
2’b11 (A or B, respectively). However, when randomizing a variable of type VStructEnum or
VUnionEnum, the solver can select 2’b00, 2’b01, 2’b10 or 2’b11.

To me, this implies my standalone testcase should work. If I extend the definition of VUnionEnum as follows

typedef enum bit [1:0] { C=2'b01, D=2'b10 } cd_e;
typedef union packed {
ab_e ValidAB;
cd_e ValidCD;
} VUnionEnum;

when randomizing ValidCD, I have values b01 and b10 available. While randomizing ValidAB, I have values b00 and b11 available. While Randomizing VUnionEnum, I have all 4 values available. Is this right?