Why error when using process::self() in static task

Hi,
why we can only use process::self() in automatic task rather than static task?
simple code below, test_0 will meet a compile error: Illegal ‘process::self()’ call context
module a;
task static test_0();
process p = process::self();
endtask
task automatic test_1();
process p = process::self();
endtask
endmodule

Thanks

In reply to jianfeng.he:

Your problem is with a static variable declaration initializations, not necessarily whether the task has a static or automatic lifetime.

A static variable gets initialized at time 0 before any processes start. So the call to process::self() is invalid. An automatic variable declaration initialization happens procedurally when the scope the variable is declared in gets activated.

The first static declaration initialization inside test_0 is illegal, notwithstanding process::self(). You are not allowed to provide an initialization to a variable that is implicitly static when it has the choice of being automatic. See function arguments not initializing variable inside the body | Verification Academy