Can I have assertions in constant function

In reply to noel:
We don’t discuss specific tools is this forum, but your code looks legal SV.
Immediate assertions can be in functions, tasks, and classes. Basically, anywhere an “if” statement is allowed.

1800’2017 “The immediate assertion statement is a test of an expression performed when the statement is executed in the procedural code. The expression is nontemporal and is interpreted the same way as an expression in the condition of a procedural if statement. In other words, if the expression evaluates to X, Z, or 0, then it is
interpreted as being false, and the assertion statement is said to fail. Otherwise, the expression is interpreted as being true, and the assertion statement is said to pass or, equivalently, to succeed."

Ben systemverilog.us