fpc/tests/webtbs/tw29491.pp
Jonas Maebe f64556c125 * when taking the address of a class method via an instance, create a procvar
with the VMT of the instance as self instead of the self instance pointer
    (mantis #29491)

git-svn-id: trunk@34395 -
2016-08-30 07:25:16 +00:00

29 lines
452 B
ObjectPascal

program test;
{$mode objfpc}{$H+}
type
TCallback = procedure of object;
TTestObject = class (TObject)
public
class procedure Test;
end;
class procedure TTestObject.Test;
begin
writeln(Self.ClassName); // Self should point to TTestObject (class)
if Self.ClassName<>'TTestObject' then
halt(1);
end;
var
Callback: TCallback;
O: TTestObject;
begin
O := TTestObject.Create;
Callback := @O.Test;
Callback();
O.Free;
end.