I'm having a problem with a set test causing a range error in a console application.
It can be reproduced by the .lpr file below.
I don't know if I'm doing something I shouldn't or if it's reproducable elsewhere.
It functions as expected if the set test is true but gives the range error when false.
Can anyone else see the issue?
Settings:
lazarus v1.6RC2
Target - defaults win7-64
Project options - range check on
Run parameters empty
Debugging enabled:
charout[1] or charout[2] prints "found" and waits for a key
charout[3] or charout[4] (ie not in set) causes "RunError(201)" in lazarus
(range error)
Also reproduces when the executable is run from command line.
program project1;
{$MODE DELPHI}
{$IFDEF WINDOWS}
{$APPTYPE CONSOLE}
{$ENDIF}
uses sysutils,classes;
Type
TalphaSet = 'A'..'Z';
TcharSet = set of TalphaSet;
var
thisChar: TcharSet;
charout: string;
procedure initProg;
begin
thisChar := ['A','B','C','D','E','F'];
charout := 'AB12';
end;
BEGIN
initProg;
if ( charout[3] in thisChar ) then // change charout here
writeln('Found')
else
writeln('Not Found'); // this is not reached
readln;
END.