View Revisions: Issue #35580

Summary 0035580: Compiler picks up wrong overload for TMemoryStream.Write(TBytes, Longint);
Revision 2019-05-25 14:33 by Jonas Maebe
Steps To Reproduce program Project1;
{$mode objfpc}
uses
  SysUtils, Classes;
var
  B1, B2: TBytes;
  S: TMemoryStream;
  I: Integer;
begin
  B1 := [1, 2, 3, 4, 5];
  S := TMemoryStream.Create;
  S.Write(B1, Length(B1)); // <<< BUG: wrong overload is called
  S.Position := 0;
  SetLength(B2, Length(B1));
  S.ReadData(B2, Length(B2));
  S.Free;
  if not(Length(B2) = Length(B1)) then
    Halt(999);
  for I := Low(B1) to High(B1) do
    if B1[I] <> B2[I] then
      Halt(I);
  Writeln('OK');
  Readln;
end.
Revision 2019-05-13 22:13 by Ondrej Pokorny
Steps To Reproduce program Project1;
{$mode objfpc}
uses
  SysUtils, Classes;
var
  B1, B2: TBytes;
  S: TMemoryStream;
  I: Integer;
begin
  B1 := [1, 2, 3, 4, 5];
  S := TMemoryStream.Create;
  S.Write(B1, Length(B1)); // <<< BUG: wrong overload is called
  S.Position := 0;
  SetLength(B2, Length(B1));
  S.ReadData(B2, Length(B2));
  S.Free;
  if not(Length(B2) = Length(B1)) then
    Halt(999);
  for I := Low(B1) to High(B1) do
    if B1[I] <> B2[I] then
      Halt(I);
  Writeln('OK');
  Readln;
end.