Delphi – E2033 Types of actual and formal var parameters must be identical

The actual argument for a variable parameter in your delphi program must be of the same type as the formal parameter.

program Produce;

procedure SwapBytes(var B1, B2 Byte);
var
  Temp: Byte;
begin
  Temp := B1; B1 := B2; B2 := Temp;
end;

var
  C1, C2 0..255;     (*Similar to a byte, but NOT identical*)
begin
  SwapBytes(C1,C2);   (*<-- Error message here*)
end.

SwapBytes rejects arguments C1 and C2, despite the fact that they have the same memory structure and range as a Byte.

How to fix it ?

program Solve;

procedure SwapBytes(var B1, B2 Byte);
var
  Temp: Byte;
begin
  Temp := B1; B1 := B2; B2 := Temp;
end;

var
  C1, C2 Byte;
begin
  SwapBytes(C1,C2);   (*<-- No error message here*)
end.

In order for this example to compile, you must specify C1 and C2 as Bytes.