A constant function contains a static variable with an initializer. That initializer will be skipped during constant evaluation, which could lead to unintuitive results.
localparam int foo = func(); function int func; static int i = 1; return i; endfunction