That is a reason, but not clear to me why?
What is the difference between first putting the pointer into a variant and then passing it and passing it directly?
Both are almost the same to me, and I need a little guidance to understand the two cases' internal differences.
I guess in this case, it may be a wrong guess by the compiler. (Only guessing).
procedure Foo(a: string); inline; begin end;
///....
foo(SomeString);
There a string (a managed type) is passed. Befere SomeString is passed, the compiler needs to call inc_ref for the string. And then afterwards decref.
Apparently none of the compiler devs has ever written the code to generate the incref/decref in case of inlining.
So then I guess in your case, the compiler sees the string in the argument list and says: not possible.
Even so, you do not actually pass a string. The compiler probably just incorrectly detects it something it can not do.
--
PChar is not managed.