Hello,
Consider the following sample program:
program const_internal_error;
const
ACONSTANT = 3;
b = 5;
{ can do this: }
{$if ACONSTANT <> b}
{$MESSAGE 'ACONSTANT is not equal to b'}
{$endif}
type
PRECORD = ^TRECORD;
TRECORD = record
FirstField : integer;
SecondField : DWORD;
end;
const
{ can define constants that represent the field offsets }
RECORD_FIRSTFIELD_OFFSET = @PRECORD(nil)^.FirstField;
RECORD_SECONDFIELD_OFFSET = @PRECORD(nil)^.SecondField;
{ CAN NOT do this: }
{$if RECORD_FIRSTFIELD_OFFSET <> 5}
{$MESSAGE 'RECORD_FIRSTFIELD_OFFSET is not equal to 5'}
{$endif}
{ NOR this: }
{$if RECORD_FIRSTFIELD_OFFSET <> RECORD_SECONDFIELD_OFFSET}
{$MESSAGE 'RECORD_FIRSTFIELD_OFFSET is not equal to RECORD_SECONDFIELD_OFFSET'}
{$endif}
begin
readln;
end.
In line 10, the preprocessor is comparing two constants without any problems.
In lines 31 and 37, constants are being compared and in both cases the compiler emits an internal error.
Refer to the attachment to see a snapshot of the compiler messages including the internal error.
To see the error produced by the second comparison (the "NOR this:" one), comment out the first comparison.
It would be very nice if this problem did not occur in the upcoming v3.2.4