mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-14 10:29:50 +02:00
* new bug
This commit is contained in:
parent
09ccea65cb
commit
895b7c6840
34
tests/webtbf/tw1949.pp
Normal file
34
tests/webtbf/tw1949.pp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{ %fail }
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
type
|
||||||
|
TMyProc = procedure;
|
||||||
|
|
||||||
|
TMyClassA = class
|
||||||
|
private
|
||||||
|
FOnMyEvent: TMyProc;
|
||||||
|
public
|
||||||
|
property OnMyEvent: TMyProc read FOnMyEvent write FOnMyEvent;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TMyClassB = class
|
||||||
|
public
|
||||||
|
MyClassA: TMyClassA;
|
||||||
|
procedure DoIt;
|
||||||
|
constructor Create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMyClassB.DoIt;
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TMyClassB.Create;
|
||||||
|
begin
|
||||||
|
MyClassA:=TMyClassA.Create;
|
||||||
|
MyClassA.OnMyEvent:=@DoIt; // DoIt is 'procedure of object' -> incompatible !
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
18
tests/webtbs/tw1950.pp
Normal file
18
tests/webtbs/tw1950.pp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{$ifdef fpc}{$mode delphi}{$endif}
|
||||||
|
|
||||||
|
uses SysUtils;
|
||||||
|
|
||||||
|
type TTest = record
|
||||||
|
a, b: integer;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure Test(const T: TTest);
|
||||||
|
begin
|
||||||
|
if @T = nil then exit;
|
||||||
|
// do something
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Test(TTest(nil^)); {case 1}
|
||||||
|
Test(TTest(Pointer(nil)^)); {case 2}
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user