Can streaming operators be used within constraints

There seems to be no mention in the LRM about this part. But some simulators complain that “streaming cannot be used in this context”.

Appreciate any clarification.

In reply to kernalmode1:

You are not allowed to have aggregate operands in constraints.

In reply to dave_59:

I see… Pardon me, but what constitute as aggregate operands?

Thanks Dave.

In reply to kernalmode1:

Unpacked arrays. LRM section 7.

In reply to dave_59:

But Dave, unpacked/packed arrays are allowed in constraints. And I believe operations such as sum,and,or etc also are. Just to be clear, by streaming operators I mean Section 11.4.14 of the LRM.

In reply to kernalmode1:

Section 18.3 says “Constraints can be any SystemVerilog expression with variables and constants of integral type”. Packed arrays are integral types, unpacked arrays are not.
Array.sum() is technically not an aggregate operand. It’s a function call returning an integral value. See section 18.5.8 for more information.

The LRM is severely out of date as many constructs such as the streaming operator came after the randomization section was written. So it’s not always clear why certain restrictions should be in place or removed.