* handle records in iso mode properly if no tag-field is given

git-svn-id: trunk@29259 -
This commit is contained in:
florian 2014-12-11 19:21:13 +00:00
parent 7897c81c77
commit dd967eb136
3 changed files with 31 additions and 5 deletions

1
.gitattributes vendored
View File

@ -11801,6 +11801,7 @@ tests/test/tisoread.pp svneol=native#text/pascal
tests/test/tisorec1.pp svneol=native#text/pascal
tests/test/tisorec2.pp svneol=native#text/pascal
tests/test/tisorec3.pp svneol=native#text/pascal
tests/test/tisorec4.pp svneol=native#text/pascal
tests/test/tlea1.pp svneol=native#text/plain
tests/test/tlea2.pp svneol=native#text/plain
tests/test/tlib1a.pp svneol=native#text/plain

View File

@ -376,11 +376,13 @@ implementation
end;
if found then
begin
{ setup variant selector }
addstatement(newstatement,cassignmentnode.create(
csubscriptnode.create(variantselectsymbol,
cderefnode.create(ctemprefnode.create(temp))),
p2));
{ if no tag-field is given, do not create an assignment statement for it }
if assigned(variantselectsymbol) then
{ setup variant selector }
addstatement(newstatement,cassignmentnode.create(
csubscriptnode.create(variantselectsymbol,
cderefnode.create(ctemprefnode.create(temp))),
p2));
end
else
Message(parser_e_illegal_expression);

23
tests/test/tisorec4.pp Normal file
View File

@ -0,0 +1,23 @@
{$mode iso}
type
tr = record
l : longint;
case integer of
1 : (s : array[0..255] of char);
2 : (n : integer);
3 : (w : word; case j : integer of
1 : (t : array[0..255] of char);
2 : (a : integer);
);
end;
pr = ^tr;
var
r : pr;
begin
new(r,3,2);
if r^.j<>2 then
halt(1);
dispose(r);
writeln('ok');
end.