Browse Source

* new bug

peter 23 years ago
parent
commit
895b7c6840
2 changed files with 52 additions and 0 deletions
  1. 34 0
      tests/webtbf/tw1949.pp
  2. 18 0
      tests/webtbs/tw1950.pp

+ 34 - 0
tests/webtbf/tw1949.pp

@@ -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 - 0
tests/webtbs/tw1950.pp

@@ -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.