* don't allow pointer indexing in non-fpc modes

* array type required message instead of type mismatch (merged)
This commit is contained in:
peter 2000-08-20 15:05:45 +00:00
parent 8bd87aafd6
commit d3aa211230

View File

@ -482,8 +482,11 @@ implementation
end; end;
{ are we accessing a pointer[], then convert the pointer to { are we accessing a pointer[], then convert the pointer to
an array first } an array first, in FPC this is allowed for all pointers in
if (p^.left^.resulttype^.deftype=pointerdef) then delphi/tp7 it's only allowed for pchars }
if (p^.left^.resulttype^.deftype=pointerdef) and
((m_fpc in aktmodeswitches) or
is_pchar(p^.left^.resulttype)) then
begin begin
{ convert pointer to array } { convert pointer to array }
harr:=new(parraydef,init(0,$7fffffff,s32bitdef)); harr:=new(parraydef,init(0,$7fffffff,s32bitdef));
@ -512,7 +515,8 @@ implementation
end; end;
end end
else else
CGMessage(type_e_mismatch); CGMessage(type_e_array_required);
{ the register calculation is easy if a const index is used } { the register calculation is easy if a const index is used }
if p^.right^.treetype=ordconstn then if p^.right^.treetype=ordconstn then
begin begin
@ -639,7 +643,11 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.5 2000-08-04 22:00:52 peter Revision 1.6 2000-08-20 15:05:45 peter
* don't allow pointer indexing in non-fpc modes
* array type required message instead of type mismatch (merged)
Revision 1.5 2000/08/04 22:00:52 peter
* merges from fixes * merges from fixes
Revision 1.4 2000/08/02 19:49:59 peter Revision 1.4 2000/08/02 19:49:59 peter