If you put the attached testcase into "Tests\SimpleScripts"-Directory it will
crash executing the script (compiles without errors). Tested with the revision
R2530.
Some notes:
1. It will not crash (test passes), if function "Setting" is called directly
(not as a function pointer)
2. It will not crash (test passes), if you execute the content of the
"DoIt"-function directly (one nesting level fewer).
---
type
TSettingFunction = function(): Boolean;
type
TFooObject = class
FValue: Integer;
constructor Create(A: Integer);
begin
FValue := A;
end;
function Value: Integer;
begin
Result := FValue;
end;
end;
var AFoo: TFooObject = nil;
function Foo: TFooObject;
begin
if AFoo = nil then
AFoo := TFooObject.Create(42);
Result := AFoo;
end;
function Setting(): Boolean;
begin
PrintLn(IntToStr(Foo.Value));
Result := True;
end;
procedure DoIt ();
begin
var SettingFunction: TSettingFunction = Setting;
// Setting(); // Works
SettingFunction(); // Crash
end;
DoIt();
Original issue reported on code.google.com by stebifi...@gmail.com on 24 Apr 2014 at 4:47
Original issue reported on code.google.com by
stebifi...@gmail.com
on 24 Apr 2014 at 4:47Attachments: