compiler: allow use of default properties for records (issue #0019098)

git-svn-id: trunk@17334 -
This commit is contained in:
paul 2011-04-18 03:15:58 +00:00
parent 62e11742bf
commit 56cd7b3450
3 changed files with 25 additions and 1 deletions

1
.gitattributes vendored
View File

@ -9694,6 +9694,7 @@ tests/test/tenum5.pp svneol=native#text/plain
tests/test/tenum6.pp svneol=native#text/pascal
tests/test/tenumerators1.pp svneol=native#text/pascal
tests/test/terecs1.pp svneol=native#text/pascal
tests/test/terecs10.pp svneol=native#text/pascal
tests/test/terecs2.pp svneol=native#text/pascal
tests/test/terecs3.pp svneol=native#text/pascal
tests/test/terecs4.pp svneol=native#text/pascal

View File

@ -1927,7 +1927,7 @@ implementation
_LECKKLAMMER:
begin
if is_class_or_interface_or_object(p1.resultdef) or
is_dispinterface(p1.resultdef) then
is_dispinterface(p1.resultdef) or is_record(p1.resultdef) then
begin
{ default property }
protsym:=search_default_property(tobjectdef(p1.resultdef));

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

@ -0,0 +1,23 @@
program terecs10;
{$ifdef fpc}
{$mode delphi}
{$endif}
type
TTest = record
function GetTest(Index: Integer): Integer;
property Test[Index: Integer]: Integer read GetTest; default;
end;
function TTest.GetTest(Index: Integer): Integer;
begin
Result := Index;
end;
var
t: TTest;
begin
if t[42] <> 42 then
halt(1);
end.