My settings don't even compile it. But probably there is a setting to turn checks off...
"TestFunction" is a nested procedure.
That means it actually has a hidden extra parameter. Which is a reference to the outer function stackframe.
The "global" var, in your case is a local var of the "TestLanguage" function, and on that stackframe.
When you call the TestFunction via the incorrect variable, then that ref to the stackframe is not initialized, so when it gets accessed....
In fpc 3.3.1 you can use
{ $ModeSwitch nestedprocvars}
type
TFunction = function(const i: Integer): Boolean is nested;
or "reference to function... " (with another modeswitch)