+ tcgtypeconvnode.second_class_to_intf supports LOC_CONSTANT as well, resolves #31596

git-svn-id: trunk@35655 -
This commit is contained in:
florian 2017-03-25 10:27:29 +00:00
parent abc4cf21d1
commit 0cf5ef459d
3 changed files with 23 additions and 0 deletions

1
.gitattributes vendored
View File

@ -15411,6 +15411,7 @@ tests/webtbs/tw3143.pp svneol=native#text/plain
tests/webtbs/tw31431.pp svneol=native#text/pascal
tests/webtbs/tw3144.pp svneol=native#text/plain
tests/webtbs/tw3157.pp svneol=native#text/plain
tests/webtbs/tw31596.pp svneol=native#text/pascal
tests/webtbs/tw3160a.pp svneol=native#text/plain
tests/webtbs/tw3160b.pp svneol=native#text/plain
tests/webtbs/tw3160c.pp svneol=native#text/plain

View File

@ -736,6 +736,11 @@ interface
begin
location.register:=left.location.register;
hlcg.g_ptrtypecast_reg(current_asmdata.CurrAsmList,left.resultdef,resultdef,location.register);
end;
LOC_CONSTANT:
begin
location.register:=hlcg.getaddressregister(current_asmdata.CurrAsmList,resultdef);
hlcg.a_load_const_reg(current_asmdata.CurrAsmList,resultdef,left.location.value,location.register);
end
else
internalerror(121120001);

17
tests/webtbs/tw31596.pp Normal file
View File

@ -0,0 +1,17 @@
{ %norun }
var
offset : Integer;
o : TObject;
begin
// OK
o := TObject(1);
offset := PtrInt(IInterface(TInterfacedObject(o))) - 1;
//
// project1.lpr(17,19) Error: Internal error 121120001
offset := PtrInt(IInterface(TInterfacedObject(1))) - 1;
end.