Yet another surprise from Delphi compiler

5

Build and run the following console app:

program ItWorks;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  TTest = record
    FData: Integer;
  end;

procedure DoTest(const S: string);
begin
  Writeln(TTest(S).FData);
end;

begin
  try
    DoTest('123');
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
  Readln;
end.

I tested in Delphi XE and Delphi 10.1 Berlin, it compiles and even works!