Преглед изворни кода

* fix for Mantis #31465: only consider non-static fields when checking whether a record may be used with Default()

+ added test (Note: the test fails due to missing = operator, but without the fix there was a stack overflow)

git-svn-id: trunk@35508 -
svenbarth пре 8 година
родитељ
комит
ece13bcc5a
3 измењених фајлова са 27 додато и 1 уклоњено
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/htypechk.pas
  3. 25 0
      tests/webtbf/tw31465.pp

+ 1 - 0
.gitattributes

@@ -13835,6 +13835,7 @@ tests/webtbf/tw3114.pp svneol=native#text/plain
 tests/webtbf/tw3116.pp svneol=native#text/plain
 tests/webtbf/tw3126.pp svneol=native#text/plain
 tests/webtbf/tw3145.pp svneol=native#text/plain
+tests/webtbf/tw31465.pp svneol=native#text/pascal
 tests/webtbf/tw3183.pp svneol=native#text/plain
 tests/webtbf/tw3186.pp svneol=native#text/plain
 tests/webtbf/tw3218.pp svneol=native#text/plain

+ 1 - 1
compiler/htypechk.pas

@@ -3519,7 +3519,7 @@ implementation
           for i:=0 to def.symtable.symlist.count-1 do
             begin
               sym:=tsym(def.symtable.symlist[i]);
-              if sym.typ<>fieldvarsym then
+              if (sym.typ<>fieldvarsym) or (sp_static in sym.symoptions) then
                 continue;
               if not is_valid_for_default(tfieldvarsym(sym).vardef) then
                 begin

+ 25 - 0
tests/webtbf/tw31465.pp

@@ -0,0 +1,25 @@
+{ %FAIL }
+
+program tw31465;
+
+{$MODE DELPHI}
+
+uses
+  FGL;
+
+type
+  THWAddr = record
+  public type
+    THWBytes = array [0..5] of Byte;
+  private
+    FValue: THWBytes;
+  public
+    class var Empty: THWAddr;
+    class var Broadcast: THWAddr;
+  end;
+
+  TGWCache = class(TFPGList<THWAddr>);
+
+begin
+
+end.