Browse Source

Fix for Mantis #29792.

htypechk.pas, tcallcandidates:
  * create_candidate_list: check the correct tableoptions for sto_has_overload flag

+ added test

git-svn-id: trunk@33211 -
svenbarth 9 năm trước cách đây
mục cha
commit
e58488dc3e
3 tập tin đã thay đổi với 35 bổ sung1 xóa
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/htypechk.pas
  3. 33 0
      tests/webtbs/tw29792.pp

+ 1 - 0
.gitattributes

@@ -14977,6 +14977,7 @@ tests/webtbs/tw29669.pp svneol=native#text/plain
 tests/webtbs/tw29669a.pp svneol=native#text/plain
 tests/webtbs/tw29669a.pp svneol=native#text/plain
 tests/webtbs/tw2975.pp svneol=native#text/plain
 tests/webtbs/tw2975.pp svneol=native#text/plain
 tests/webtbs/tw2976.pp svneol=native#text/plain
 tests/webtbs/tw2976.pp svneol=native#text/plain
+tests/webtbs/tw29792.pp svneol=native#text/pascal
 tests/webtbs/tw2983.pp svneol=native#text/plain
 tests/webtbs/tw2983.pp svneol=native#text/plain
 tests/webtbs/tw2984.pp svneol=native#text/plain
 tests/webtbs/tw2984.pp svneol=native#text/plain
 tests/webtbs/tw2998.pp svneol=native#text/plain
 tests/webtbs/tw2998.pp svneol=native#text/plain

+ 1 - 1
compiler/htypechk.pas

@@ -2396,7 +2396,7 @@ implementation
             while assigned(pt) do
             while assigned(pt) do
               begin
               begin
                 if (pt.resultdef.typ=recorddef) and
                 if (pt.resultdef.typ=recorddef) and
-                    (sto_has_operator in tabstractrecorddef(pt.resultdef).owner.tableoptions) then
+                    (sto_has_operator in tabstractrecorddef(pt.resultdef).symtable.tableoptions) then
                   collect_overloads_in_struct(tabstractrecorddef(pt.resultdef),ProcdefOverloadList,searchhelpers,anoninherited,spezcontext);
                   collect_overloads_in_struct(tabstractrecorddef(pt.resultdef),ProcdefOverloadList,searchhelpers,anoninherited,spezcontext);
                 pt:=tcallparanode(pt.right);
                 pt:=tcallparanode(pt.right);
               end;
               end;

+ 33 - 0
tests/webtbs/tw29792.pp

@@ -0,0 +1,33 @@
+unit tw29792;
+
+{$mode delphi}
+
+interface
+
+type
+  { TMyRecord }
+
+  TMyRecord<T> = record
+    class operator Add(A,B: TMyRecord<T>): TMyRecord<T>;
+  end;
+
+implementation
+
+{ TMyRecord }
+
+class operator TMyRecord<T>.Add(A, B: TMyRecord<T>): TMyRecord<T>;
+begin
+  // add implementation
+end;
+
+procedure TestIfCompiles;
+type
+  TInteger = TMyRecord<Integer>;
+var
+  N1, N2, N3: TInteger;
+begin
+  N1 := N2 + N3;
+end;
+
+end.
+