I'm trying to compile the following code in Delphi Rio:
unit untObjectHelper;
interface
uses
SysUtils;
type
TObjectHelper = class(TInterfacedObject)
public
class procedure Clone(const objOrigem: TObject; const objDestino: TObject);
end;
implementation
uses
System.Rtti;
{ TObjectHelper }
class procedure TObjectHelper.Clone(const objOrigem,
objDestino: TObject);
begin
if not Assigned(objOrigem) then
Exit;
if not Assigned(objDestino) then
Exit;
if objOrigem.ClassType <> objDestino.ClassType then
Exit;
var contexto := TRttiContext.Create;
try
var tipo := contexto.GetType(objOrigem.ClassType);
var campos := tipo.GetFields();
finally
contexto.Free;
end;
end;
end.
however the following error occurs:
[dcc32 Fatal Error] untObjectHelper.pas (36): F2084 Internal Error: NC1921
on the line:
var fields: = type.GetFields ();
version: Embarcadero® Delphi 10.3 Version 26.0.33219.4899
I did not find reference to this error, could someone help me? thank you very much