Browse Source

* test for tw36212

git-svn-id: trunk@43385 -
florian 5 years ago
parent
commit
d3c5bd2a3e
2 changed files with 41 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 40 0
      tests/webtbs/tw36212.pp

+ 1 - 0
.gitattributes

@@ -17854,6 +17854,7 @@ tests/webtbs/tw3617.pp svneol=native#text/plain
 tests/webtbs/tw3619.pp svneol=native#text/plain
 tests/webtbs/tw36196.pp svneol=native#text/pascal
 tests/webtbs/tw3621.pp svneol=native#text/plain
+tests/webtbs/tw36212.pp svneol=native#text/pascal
 tests/webtbs/tw36215.pp svneol=native#text/pascal
 tests/webtbs/tw3628.pp svneol=native#text/plain
 tests/webtbs/tw3634.pp svneol=native#text/plain

+ 40 - 0
tests/webtbs/tw36212.pp

@@ -0,0 +1,40 @@
+{ %OPT=-O4 }
+program Project1;
+{$mode delphi}
+type
+  TSinglePoint = record
+    X, Y: Single;
+  public
+    constructor Create(const aX, aY: Single);
+  end;
+{ TSinglePoint }
+constructor TSinglePoint.Create(const aX, aY: Single);
+begin
+  X := aX;
+  Y := aY;
+end;
+
+type
+  TMyObj = class
+  public
+    function Test: TSinglePoint;
+  end;
+{ TMyObj }
+function TMyObj.Test: TSinglePoint;
+begin
+  Result := TSinglePoint.Create(0, 0);
+end;
+
+var
+  MyObj: TMyObj;
+  i : PtrUInt;
+begin
+  MyObj := TMyObj.Create;
+  Writeln(PtrUInt(MyObj));
+  i:=PtrUInt(MyObj);
+  MyObj.Test;
+  Writeln(PtrUInt(MyObj));
+  if i<>PtrUInt(MyObj) then
+    halt(1);
+  writeln('ok');
+end.