* correctly write the type of open array parameters as the element def and not the array def

+ added test that shows the linking error if not done so (otherwise that should already be covered by trtti15.pp)

git-svn-id: trunk@37083 -
This commit is contained in:
svenbarth 2017-08-29 20:17:24 +00:00
parent ce958cacc4
commit 7b675b6769
3 changed files with 30 additions and 2 deletions

1
.gitattributes vendored
View File

@ -11376,6 +11376,7 @@ tests/tbs/tb0627a.pp svneol=native#text/pascal
tests/tbs/tb0627b.pp svneol=native#text/pascal
tests/tbs/tb0628.pp svneol=native#text/pascal
tests/tbs/tb0629.pp svneol=native#text/pascal
tests/tbs/tb0630.pp svneol=native#text/pascal
tests/tbs/tb205.pp svneol=native#text/plain
tests/tbs/tb610.pp svneol=native#text/pascal
tests/tbs/tb613.pp svneol=native#text/plain

View File

@ -1241,7 +1241,10 @@ implementation
{ write flags for current parameter }
write_param_flag(tcb,parasym);
{ write param type }
write_rtti_reference(tcb,parasym.vardef,fullrtti);
if is_open_array(parasym.vardef) then
write_rtti_reference(tcb,tarraydef(parasym.vardef).elementdef,fullrtti)
else
write_rtti_reference(tcb,parasym.vardef,fullrtti);
{ write name of current parameter }
tcb.emit_shortstring_const(parasym.realname);
tcb.end_anonymous_record;
@ -1286,7 +1289,12 @@ implementation
{ write params typeinfo }
for i:=0 to def.paras.count-1 do
if not(vo_is_hidden_para in tparavarsym(def.paras[i]).varoptions) then
write_rtti_reference(tcb,tparavarsym(def.paras[i]).vardef,fullrtti);
begin
if is_open_array(tparavarsym(def.paras[i]).vardef) then
write_rtti_reference(tcb,tarraydef(tparavarsym(def.paras[i]).vardef).elementdef,fullrtti)
else
write_rtti_reference(tcb,tparavarsym(def.paras[i]).vardef,fullrtti);
end;
tcb.end_anonymous_record;
end
else

19
tests/tbs/tb0630.pp Normal file
View File

@ -0,0 +1,19 @@
{ %NORUN }
program tb0630;
uses
typinfo;
type
TTest = record
test: procedure(aTest: array of LongInt);
end;
TTestArray = array[0..1] of TTest;
var
ti: PTypeInfo;
begin
ti := TypeInfo(TTest);
end.