fpc/tests/webtbs/tw20873.pp
Jonas Maebe ceee186f2f * typecheck all array indices, not just integer and boolean types
o allows converting indices to the proper type if required (such as
     variant, mantis #20873)
   o do not create temporary defs for this type checking anymore if not
     necessary
   o makes sure that errors are thrown in case of conversions considered
     as invalid by the compiler rather than that wrong code is silently
     generated (such as in mantis #20873 before this change)

git-svn-id: trunk@20108 -
2012-01-18 21:29:44 +00:00

18 lines
313 B
ObjectPascal

{$MODE OBJFPC}
program variant_bug;
uses variants;
var SomeArray : array[1..10] of DWord;
v : Variant;
y: longint;
begin
for y := 1 to 10 do SomeArray[y] := 0;
v := 7;
SomeArray[ v ] := 1;
for y := 1 to 10 do Write( SomeArray[y] );
writeln;
if somearray[v]<>1 then
halt(1);
end.