Why is this an issue?

A constant function contains a static variable with an initializer. That initializer will be skipped during constant evaluation, which could lead to unintuitive results.

How to fix it

Code examples

Noncompliant code example

localparam int foo = func();
function int func;
  static int i = 1;
  return i;
endfunction