Can we please get the compiler generate W1035 (Return value of function might be undefined) for managed data types...

Can we please get the compiler generate W1035 (Return value of function might be undefined) for managed data types also?

While I understand why this is not happening atm (internal handling of Result as var/out parameter) it would be very useful and prevent errors.

Code like this would show an error and avoid wrong data:

function Foo(list: TStringList): string;
var
  s: string;
begin
  for s in list do
    Result := Result + s;
end;

Currently it does not show any warning and might have an unexpected result depending on what was inside the variable the function result is assigned to.

Comments