class A;
endclass
class B extends A;
constraint c_B {};
endclass
class C extends B;
endclass
In test, I define A_tr with A type,
----A A_tr;
and override the type with C;
----set_type_override_by_type(A::get_type, C::get_type);
Now, I want to shut off constraint c_B, then I define B_tr with B type,
----B B_tr;
And then,
----B_tr = A_tr; //Since A_tr now is of type C; if i use $cast(B_tr, A_tr), the result is the same
----B_tr.c_B.constraint_mode(0);
When compile, it will report Error :
“The expression B_tr.c_B,constraint_mode contains a reference to constraint c_B, which is allowed only to to call the constraint_mode()”
Hi Dave,
Yes, I have this similar question 4 years ago, but seems different.
Actually, these two should be the same problem. Thus I tried define a trans B_tr and assign A_tr(now is type C) to handler B_tr, I think B_tr could access constraint c_B, and shut if off, but seems to fail. And error report now is “The expression B_tr.c_B,constraint_mode contains a reference to constraint c_B, which is allowed only to to call the constraint_mode()”.
So, I’m confused.
PS, the previous one reports Error “Could not find member c_B in class A_h”