mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-02 20:50:57 +01:00
* fixed array[..] of char <op> pchar: wrong type was determined for non op<>+ returned
git-svn-id: trunk@1107 -
This commit is contained in:
parent
21cc9597f2
commit
fa1575aeab
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -4971,6 +4971,7 @@ tests/tbs/tb0490.pp svneol=native#text/plain
|
||||
tests/tbs/tb0491.pp svneol=native#text/plain
|
||||
tests/tbs/tb0492.pp svneol=native#text/plain
|
||||
tests/tbs/tb0493.pp svneol=native#text/plain
|
||||
tests/tbs/tb0494.pp -text
|
||||
tests/tbs/ub0060.pp svneol=native#text/plain
|
||||
tests/tbs/ub0069.pp svneol=native#text/plain
|
||||
tests/tbs/ub0119.pp svneol=native#text/plain
|
||||
|
||||
@ -1085,20 +1085,24 @@ implementation
|
||||
inserttypeconv(right,left.resulttype);
|
||||
end;
|
||||
end
|
||||
|
||||
{ compare pchar to char arrays by addresses like BP/Delphi }
|
||||
else if ((is_pchar(ld) or (lt=niln)) and is_chararray(rd)) or
|
||||
((is_pchar(rd) or (rt=niln)) and is_chararray(ld)) then
|
||||
begin
|
||||
if is_chararray(rd) then
|
||||
inserttypeconv(right,charpointertype)
|
||||
else
|
||||
inserttypeconv(left,charpointertype);
|
||||
end
|
||||
|
||||
{ pointer comparision and subtraction }
|
||||
else if (rd.deftype=pointerdef) and (ld.deftype=pointerdef) then
|
||||
else if ((rd.deftype=pointerdef) and (ld.deftype=pointerdef)) or
|
||||
{ compare pchar to char arrays by addresses like BP/Delphi }
|
||||
((is_pchar(ld) or (lt=niln)) and is_chararray(rd)) or
|
||||
((is_pchar(rd) or (rt=niln)) and is_chararray(ld)) then
|
||||
begin
|
||||
{ convert char array to pointer }
|
||||
if is_chararray(rd) then
|
||||
begin
|
||||
inserttypeconv(right,charpointertype);
|
||||
rd:=right.resulttype.def;
|
||||
end
|
||||
else if is_chararray(ld) then
|
||||
begin
|
||||
inserttypeconv(left,charpointertype);
|
||||
ld:=left.resulttype.def;
|
||||
end;
|
||||
|
||||
case nodetype of
|
||||
equaln,unequaln :
|
||||
begin
|
||||
|
||||
12
tests/tbs/tb0494.pp
Normal file
12
tests/tbs/tb0494.pp
Normal file
@ -0,0 +1,12 @@
|
||||
{ the test checks only if the syntax is possible }
|
||||
var
|
||||
ca : array[0..1000] of char;
|
||||
p1 : pchar;
|
||||
|
||||
begin
|
||||
p1:=nil;
|
||||
if (ca-p1)=0 then
|
||||
halt(1);
|
||||
p1:=ca;
|
||||
end.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user