Delphi Error – E2083 Order of fields in record constant differs from declaration

Delphi Compiler Error

E2083 Order of fields in record constant differs from declaration

Reason for the Error & Solution

This error message occurs if record fields in a typed constant or initialized variable are not initialized in declaration order.

program Produce;

type
  TPoint = record
    X, Y: Integer;
  end;

var
  Point : TPoint = (Y: 123; X: 456);

begin
end.

The example tries to initialize first Y, then X, in the opposite order from the declaration.

program Solve;

type
  TPoint = record
    X, Y: Integer;
  end;

var
  Point : TPoint = (X: 456; Y: 123);

begin
end.

The solution is to adjust the order of initialization to correspond to the declaration order.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error X2421 Imported identifier ‘%s’ conflicts with ‘%s’ in ‘%s’ Reason for the Error & Solution This occurs...
Delphi Compiler Error X2367 Case of property accessor method %s.%s should be %s.%s Reason for the Error & Solution No...
Delphi Compiler Error X2269 Overriding virtual method ‘%s.%s’ has lower visibility (%s) than base class ‘%s’ (%s) Reason for the...