Smart pascal source code
{ main.pas }
function Test(o : TObject) : TObject;
begin
Result:=o;
end;
function TestNil : TObject;
begin
Result:=nil;
end;
Begin
if not Assigned(TObject.Create) then
WriteLn('bug 1');
if not Assigned(Test(TObject.Create)) then
WriteLn('bug 2');
if Assigned(Test(nil)) then
WriteLn('bug 3');
if Assigned(TestNil) then
WriteLn('bug 4');
if Assigned(ExceptObject) then
WriteLn('bug 5');
{ OUTPUT CONSOLE
Runtime Error: ExceptObject is not defined
}
function TestNil() {
return null;
};
function Test(o) {
return o;
};
if (!TObject.Create($New(TObject))) {
WriteLn("bug 1");
}
if (!Test(TObject.Create($New(TObject)))) {
WriteLn("bug 2");
}
if (Test(null)) {
WriteLn("bug 3");
}
if (TestNil()) {
WriteLn("bug 4");
}
if (ExceptObject()) {
WriteLn("bug 5");
}