免费 Pascal 警告 "function result variable of a managed type does not seem to be initialized"

Free Pascal warning "function result variable of a managed type does not seem to be initialized"

Free Pascal 3.2.0 发出有关缺少 TBytes 类型函数结果初始化的警告:

function ToBytes(const AValue: RawByteString): TBytes;
begin
  
  SetLength(Result, Length(AValue));    <--- Warning

  if Length(AValue) > 0 then
    Move(AValue[1], Result[0], Length(AValue));

end;

Warning: function result variable of a managed type does not seem to be initialized

TBytes 声明:

TBytes = array of Byte;

如何修复此警告?

添加“结果:=nil;”

添加此警告的原因在 https://bugs.freepascal.org/view.php?id=36973

中进行了解释