From 624a7be9b1379818525ec85acbf01baf828ce242 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 22 Mar 2009 16:21:06 +0000 Subject: [PATCH] * fixed internal error when a subscripted object is used in a property (mantis #12756) git-svn-id: trunk@12956 - --- .gitattributes | 1 + compiler/ncgrtti.pas | 4 +++- tests/webtbs/tw12756.pp | 24 ++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 tests/webtbs/tw12756.pp diff --git a/.gitattributes b/.gitattributes index 2765d5b3df..5d8793468e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8777,6 +8777,7 @@ tests/webtbs/tw12614.pp svneol=native#text/plain tests/webtbs/tw12685.pp svneol=native#text/plain tests/webtbs/tw1269.pp svneol=native#text/plain tests/webtbs/tw1275.pp svneol=native#text/plain +tests/webtbs/tw12756.pp svneol=native#text/plain tests/webtbs/tw12788.pp svneol=native#text/plain tests/webtbs/tw1279.pp svneol=native#text/plain tests/webtbs/tw1283.pp svneol=native#text/plain diff --git a/compiler/ncgrtti.pas b/compiler/ncgrtti.pas index fe0bd2103f..0c05298acd 100644 --- a/compiler/ncgrtti.pas +++ b/compiler/ncgrtti.pas @@ -271,7 +271,9 @@ implementation end; sl_subscript : begin - if not(assigned(def) and (def.typ=recorddef)) then + if not(assigned(def) and + ((def.typ=recorddef) or + is_object(def))) then internalerror(200402171); inc(address,tfieldvarsym(hp^.sym).fieldoffset); def:=tfieldvarsym(hp^.sym).vardef; diff --git a/tests/webtbs/tw12756.pp b/tests/webtbs/tw12756.pp new file mode 100644 index 0000000000..b7220930aa --- /dev/null +++ b/tests/webtbs/tw12756.pp @@ -0,0 +1,24 @@ +{$mode delphi} +{$M+} + +type + TFooR = object { put "record" here and it works. } + Thing : integer; + end; + + TFoo = class + private + fRecord : TFooR; + published + property Thing : integer read fRecord.Thing; + end; + +var + fFoo : TFoo; +begin + fFoo := TFoo.Create; + fFoo.fRecord.Thing:=123; + if (fFoo.Thing <> 123) then + halt(1); + fFoo.free; +end.