Fix for Mantis #29609.

pexpr.pas, factor.factor_read_id:
  * don't use a cloadvmtaddrnode for accessing class properties in records

+ added test

git-svn-id: trunk@33110 -
This commit is contained in:
svenbarth 2016-02-19 21:37:02 +00:00
parent 1945bf64b4
commit 25744dd3f1
3 changed files with 28 additions and 1 deletions

1
.gitattributes vendored
View File

@ -14937,6 +14937,7 @@ tests/webtbs/tw2953.pp svneol=native#text/plain
tests/webtbs/tw29546.pp svneol=native#text/pascal
tests/webtbs/tw2956.pp svneol=native#text/plain
tests/webtbs/tw2958.pp svneol=native#text/plain
tests/webtbs/tw29609.pp svneol=native#text/pascal
tests/webtbs/tw2966.pp svneol=native#text/plain
tests/webtbs/tw2975.pp svneol=native#text/plain
tests/webtbs/tw2976.pp svneol=native#text/plain

View File

@ -3093,7 +3093,11 @@ implementation
{ it as a class member }
if (assigned(current_structdef) and (current_structdef<>hdef) and is_owned_by(current_structdef,hdef)) or
(assigned(current_procinfo) and current_procinfo.get_normal_proc.procdef.no_self_node) then
p1:=cloadvmtaddrnode.create(ctypenode.create(hdef))
begin
p1:=ctypenode.create(hdef);
if not is_record(hdef) then
p1:=cloadvmtaddrnode.create(p1);
end
else
p1:=load_self_node;
{ not srsymtable.symtabletype since that can be }

22
tests/webtbs/tw29609.pp Normal file
View File

@ -0,0 +1,22 @@
{ %NORUN }
{$mode objfpc}
{$MODESWITCH AdvancedRecords}
program tw29609;
type t = record
class var v : Boolean;
class function f : Boolean; static;
class property p : Boolean read v;
end;
class function t.f : Boolean;
begin
Result := p; // "Error: Pointer to object expected"
end;
begin
end.