Ver Fonte

* fix for Mantis #31118: applied patch by Maciej Izak to fix usage of wrong variable
+ added test

git-svn-id: trunk@35133 -

svenbarth há 8 anos atrás
pai
commit
121a857af8
3 ficheiros alterados com 30 adições e 1 exclusões
  1. 1 0
      .gitattributes
  2. 1 1
      rtl/inc/rtti.inc
  3. 28 0
      tests/test/trtti11.pp

+ 1 - 0
.gitattributes

@@ -13007,6 +13007,7 @@ tests/test/trstr7.pp svneol=native#text/plain
 tests/test/trstr8.pp svneol=native#text/plain
 tests/test/trtti1.pp svneol=native#text/plain
 tests/test/trtti10.pp svneol=native#text/pascal
+tests/test/trtti11.pp svneol=native#text/pascal
 tests/test/trtti2.pp svneol=native#text/plain
 tests/test/trtti3.pp svneol=native#text/plain
 tests/test/trtti4.pp svneol=native#text/plain

+ 1 - 1
rtl/inc/rtti.inc

@@ -116,7 +116,7 @@ begin
   { check terminator, maybe we are already in init table }
   if Assigned(PRecordInfoInit(typeInfo)^.Terminator) then
     { point to more optimal initrtti }
-    result:=PRecordInfoFull(result)^.InitTable;
+    result:=PRecordInfoFull(typeInfo)^.InitTable;
 {$endif VER3_0}
 end;
 

+ 28 - 0
tests/test/trtti11.pp

@@ -0,0 +1,28 @@
+program trtti11;
+
+{$MODE DELPHI}
+
+uses
+  SysUtils;
+
+type
+  PFoo = ^TFoo;
+  TFoo = packed record
+  public
+    F: Integer;
+    S: string;
+  end;
+
+var
+  PF: PFoo;
+begin
+  try
+    GetMem(PF, SizeOf(TFoo));
+    InitializeArray(PF, TypeInfo(TFoo), 1);
+    PF.S := 'foo';
+    FinalizeArray(PF, TypeInfo(TFoo), 1);
+    FreeMem(PF);
+  except
+    Halt(1);
+  end;
+end.