* 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 -
This commit is contained in:
svenbarth 2017-03-03 17:03:46 +00:00
parent c16238e8dd
commit ece13bcc5a
3 changed files with 27 additions and 1 deletions

1
.gitattributes vendored
View File

@ -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

View File

@ -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
tests/webtbf/tw31465.pp Normal file
View File

@ -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.