Internal error 2013112802 when comparing constants
Summary
The compiler emits an internal error when a field offset constant is compared to a literal constant.
System Information
- Operating system: Windows 7 SP1 but likely independent of O/S version
- Processor architecture: 64 bit
- Compiler version: v3.2.2
- Device: Computer
Steps to reproduce
compile the following code:
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.
Example Project
see above
What is the current bug behavior?
the compiler emits an internal error message
What is the expected (correct) behavior?
the comparison to be carried out and its boolean result to be evaluated
Relevant logs and/or screenshots
Just compile the example code
Possible fixes
Edited by 440bx 440bx