diff --git a/.gitattributes b/.gitattributes index 56d8acda9d..b4a2613f76 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/compiler/pinline.pas b/compiler/pinline.pas index 438d504a68..6c83df2784 100644 --- a/compiler/pinline.pas +++ b/compiler/pinline.pas @@ -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); diff --git a/tests/test/tisorec4.pp b/tests/test/tisorec4.pp new file mode 100644 index 0000000000..24e321741a --- /dev/null +++ b/tests/test/tisorec4.pp @@ -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.