Unsafe type in Spring.pas

Issue #348 invalid
Jacek Laskowski created an issue

The compiler warns about the "unsafe type" in the Spring.pas file, I don't know if this is a sensible report or a false report.

[dcc32 Warning] Spring.pas(8999): E1046 Unsafe type 'TFieldTable'

procedure MoveManaged(source, target, typeInfo: Pointer; count: Integer);
type
  TFieldInfo = packed record
    TypeInfo: PPTypeInfo;
    Offset: NativeInt;
  end;

  PFieldTable = ^TFieldTable;
  TFieldTable = packed record
    Size: Integer;
    Count: Integer;
    case TTypeKind of   <====================== in this line
    tkArray:  ( ElemType: PPTypeInfo );
    tkRecord: ( Fields: array[0..0] of TFieldInfo );
  end;

  function GetFieldTable(typeInfo: Pointer): PFieldTable; inline;
  begin
    Result := PFieldTable(PByte(typeInfo) + PByte(typeInfo)[1] + 2);
  end;

Comments (3)

  1. Stefan Glienke repo owner

    Compiler Version? Platform? Any compiler option that differ from those in the package for that compiler version?

  2. Jacek Laskowski reporter

    Delphi 10.3.2, x86

    Output warning → Unsafe type → True

    I first set Unsafe Type → Error, but then I had a compilation error just, after change to True I get warning only. I don't know if it's important, but I report.

  3. Log in to comment