Przeglądaj źródła

* probably mark an overloaded := operator used as type conversion as used, resolves #18909

git-svn-id: trunk@17320 -
florian 14 lat temu
rodzic
commit
58fcf9dc52

+ 3 - 0
.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

+ 2 - 2
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;

+ 9 - 0
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.

+ 14 - 0
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.

+ 16 - 0
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.