fpc/tests/test/trtti8.pp
paul dce960c97b compiler: write Delphi compatible tkArray RTTI:
- TotalSize of all array dimensions instead of first dimension size
  - Element type of last array dimension
  - dimension information
rtl:
  - adopt array initialization/finalization/copy for the new tkArray RTTI
  - add Delphi compatible TArrayTypeData member for typinfo.TTypeData structure
tests:
  - add a test which checks RTTI information for 2 dimension array

git-svn-id: trunk@24458 -
2013-05-07 09:12:18 +00:00

30 lines
620 B
ObjectPascal

program trtti8;
{$mode delphi}
uses
typinfo;
type
TColor = (red, green, blue);
TFirstArr = array[0..3] of Integer;
TArr = array[TColor] of TFirstArr;
var
Info: PTypeInfo;
Data: PTypeData;
begin
Info := TypeInfo(TArr);
if Info^.Kind <> tkArray then
halt(1);
Data := GetTypeData(Info);
if Data^.ArrayData.Size <> 12 * SizeOf(Integer) then
halt(2);
if Data^.ArrayData.ElCount <> 12 then
halt(3);
if Data^.ArrayData.ElType <> TypeInfo(Integer) then
halt(4);
if Data^.ArrayData.DimCount <> 2 then
halt(5);
if Data^.ArrayData.Dims[0] <> TypeInfo(TColor) then
halt(6)
end.