mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 07:59:27 +02:00
* convert booleans to the actual array index type (mantis #15364)
git-svn-id: trunk@14445 -
This commit is contained in:
parent
5f10ff067f
commit
10cfba3b28
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10139,6 +10139,7 @@ tests/webtbs/tw15293.pp svneol=native#text/plain
|
||||
tests/webtbs/tw15293a.pp svneol=native#text/plain
|
||||
tests/webtbs/tw15304.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1532.pp svneol=native#text/plain
|
||||
tests/webtbs/tw15364.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1539.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1567.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1573.pp svneol=native#text/plain
|
||||
|
@ -733,9 +733,9 @@ implementation
|
||||
exit;
|
||||
|
||||
{ maybe type conversion for the index value, but
|
||||
do not convert enums,booleans,char
|
||||
do not convert enums, char (why not? (JM))
|
||||
and do not convert range nodes }
|
||||
if (right.nodetype<>rangen) and (is_integer(right.resultdef) or (left.resultdef.typ<>arraydef)) then
|
||||
if (right.nodetype<>rangen) and (is_integer(right.resultdef) or is_boolean(right.resultdef) or (left.resultdef.typ<>arraydef)) then
|
||||
case left.resultdef.typ of
|
||||
arraydef:
|
||||
if ado_isvariant in Tarraydef(left.resultdef).arrayoptions then
|
||||
@ -748,6 +748,9 @@ implementation
|
||||
{Arrays without a high bound (dynamic arrays, open arrays) are zero based,
|
||||
convert indexes into these arrays to aword.}
|
||||
inserttypeconv(right,uinttype)
|
||||
{ convert between pasbool and cbool if necessary }
|
||||
else if is_boolean(right.resultdef) then
|
||||
inserttypeconv(right,tarraydef(left.resultdef).rangedef)
|
||||
else
|
||||
{Convert array indexes to low_bound..high_bound.}
|
||||
inserttypeconv(right,Torddef.create(Torddef(sinttype).ordtype,
|
||||
|
16
tests/webtbs/tw15364.pp
Normal file
16
tests/webtbs/tw15364.pp
Normal file
@ -0,0 +1,16 @@
|
||||
program test;
|
||||
|
||||
uses sysutils;
|
||||
|
||||
var
|
||||
a : array [Boolean,Boolean] of string;
|
||||
b : wordbool;
|
||||
begin
|
||||
a[False,True] := 'True';
|
||||
a[False,False] := 'False';
|
||||
a[True,True] := 'True';
|
||||
a[True,False] := 'False';
|
||||
b := True;
|
||||
if a[false,b]<>'True' then
|
||||
halt(1);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user