瀏覽代碼

* allow conversion from niln to not-yet-fully-resolved classrefdefs
(mantis #22593)

git-svn-id: trunk@22025 -

Jonas Maebe 13 年之前
父節點
當前提交
a63a603cc1
共有 3 個文件被更改,包括 28 次插入1 次删除
  1. 1 0
      .gitattributes
  2. 2 1
      compiler/defcmp.pas
  3. 25 0
      tests/webtbs/tw22593.pp

+ 1 - 0
.gitattributes

@@ -12777,6 +12777,7 @@ tests/webtbs/tw2250.pp svneol=native#text/plain
 tests/webtbs/tw22502.pp svneol=native#text/plain
 tests/webtbs/tw22561.pp svneol=native#text/plain
 tests/webtbs/tw2259.pp svneol=native#text/plain
+tests/webtbs/tw22593.pp svneol=native#text/plain
 tests/webtbs/tw2260.pp svneol=native#text/plain
 tests/webtbs/tw2266.pp svneol=native#text/plain
 tests/webtbs/tw2267.pp svneol=native#text/plain

+ 2 - 1
compiler/defcmp.pas

@@ -1560,7 +1560,8 @@ implementation
                if assigned(def_to.typesym) and
                   (tclassrefdef(def_to).pointeddef.typ=forwarddef) then
                  begin
-                   if (def_from.typesym=def_to.typesym) then
+                   if (def_from.typesym=def_to.typesym) or
+                      (fromtreetype=niln) then
                     eq:=te_equal;
                  end
                else

+ 25 - 0
tests/webtbs/tw22593.pp

@@ -0,0 +1,25 @@
+{ %norun }
+
+{$ifdef fpc}
+{$mode objfpc}
+{$endif}
+
+type
+  tc = class
+  end;
+  tcc = class of tc;
+  tc3 = class;
+
+  tc2 = class
+    constructor create(c: tcc = nil; c3: tc3 = nil);
+  end;
+
+  tc3 = class
+  end;
+
+constructor tc2.create(c: tcc = nil; c3: tc3 = nil);
+begin
+end;
+
+begin
+end.