diff --git a/.gitattributes b/.gitattributes index 99101c6693..14dccada6d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -11283,6 +11283,7 @@ tests/webtbs/tw1883.pp svneol=native#text/plain tests/webtbs/tw18859.pp svneol=native#text/plain tests/webtbs/tw1888.pp svneol=native#text/plain tests/webtbs/tw1889.pp svneol=native#text/plain +tests/webtbs/tw18909.pp svneol=native#text/pascal tests/webtbs/tw1896.pp svneol=native#text/plain tests/webtbs/tw1901.pp svneol=native#text/plain tests/webtbs/tw1902.pp svneol=native#text/plain @@ -12123,6 +12124,8 @@ tests/webtbs/uw17493.pp svneol=native#text/plain tests/webtbs/uw17950.pas svneol=native#text/pascal tests/webtbs/uw18087a.pp svneol=native#text/pascal tests/webtbs/uw18087b.pp svneol=native#text/pascal +tests/webtbs/uw18909a.pp svneol=native#text/pascal +tests/webtbs/uw18909b.pp svneol=native#text/pascal tests/webtbs/uw2004.inc svneol=native#text/plain tests/webtbs/uw2040.pp svneol=native#text/plain tests/webtbs/uw2266a.inc svneol=native#text/plain diff --git a/compiler/ncnv.pas b/compiler/ncnv.pas index 9fbda6560a..55a6ca67dd 100644 --- a/compiler/ncnv.pas +++ b/compiler/ncnv.pas @@ -187,7 +187,7 @@ interface procedure second_nothing; virtual;abstract; end; ttypeconvnodeclass = class of ttypeconvnode; - + { common functionality of as-nodes and is-nodes } tasisnode = class(tbinarynode) public @@ -1798,7 +1798,7 @@ implementation te_convert_operator : begin include(current_procinfo.flags,pi_do_call); - aprocdef.procsym.IncRefCountBy(1); + addsymref(aprocdef.procsym); hp:=ccallnode.create(ccallparanode.create(left,nil),Tprocsym(aprocdef.procsym),nil,nil,[]); { tell explicitly which def we must use !! (PM) } tcallnode(hp).procdefinition:=aprocdef; diff --git a/tests/webtbs/tw18909.pp b/tests/webtbs/tw18909.pp new file mode 100644 index 0000000000..233b0872dd --- /dev/null +++ b/tests/webtbs/tw18909.pp @@ -0,0 +1,9 @@ +{$mode objfpc} +uses uw18909a, uw18909b; +var + a: TA = (x: 1); + b: TB = (x: 1); +begin + b := a; + Write(b.x); +end. diff --git a/tests/webtbs/uw18909a.pp b/tests/webtbs/uw18909a.pp new file mode 100644 index 0000000000..baf035143e --- /dev/null +++ b/tests/webtbs/uw18909a.pp @@ -0,0 +1,14 @@ +{ %norun } +unit uw18909a; + +{$mode objfpc} + +interface + +type + TA = record x: Integer; end; + TB = record x: Integer; end; + +implementation + +end. diff --git a/tests/webtbs/uw18909b.pp b/tests/webtbs/uw18909b.pp new file mode 100644 index 0000000000..c7df5ab5aa --- /dev/null +++ b/tests/webtbs/uw18909b.pp @@ -0,0 +1,16 @@ +{ %norun } +unit uw18909b; + +{$mode objfpc} + +interface + +uses uw18909a; + +operator :=(const A: TA): TB; + +implementation + +operator :=(const A: TA): TB; begin Result.x := A.x; end; + +end.