소스 검색

Fix for Mantis #30357.

Reset tstoredsymtable.init_final_check_done when a symbol is added or removed as otherwise property getters in a record *before* any managed field would trigger it, thus leading to the record being considered as "non-managed".

git-svn-id: trunk@34088 -
svenbarth 9 년 전
부모
커밋
54b6cacf36
3개의 변경된 파일41개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      .gitattributes
  2. 2 0
      compiler/symtable.pas
  3. 38 0
      tests/webtbs/tw30357.pp

+ 1 - 0
.gitattributes

@@ -15127,6 +15127,7 @@ tests/webtbs/tw3023.pp svneol=native#text/plain
 tests/webtbs/tw30240.pp svneol=native#text/plain
 tests/webtbs/tw3028.pp svneol=native#text/plain
 tests/webtbs/tw30329.pp -text svneol=native#text/plain
+tests/webtbs/tw30357.pp svneol=native#text/pascal
 tests/webtbs/tw3038.pp svneol=native#text/plain
 tests/webtbs/tw3041.pp svneol=native#text/plain
 tests/webtbs/tw3045.pp svneol=native#text/plain

+ 2 - 0
compiler/symtable.pas

@@ -453,12 +453,14 @@ implementation
     procedure tstoredsymtable.insert(sym:TSymEntry;checkdup:boolean=true);
       begin
         inherited insert(sym,checkdup);
+        init_final_check_done:=false;
       end;
 
 
     procedure tstoredsymtable.delete(sym:TSymEntry);
       begin
         inherited delete(sym);
+        init_final_check_done:=false;
       end;
 
 

+ 38 - 0
tests/webtbs/tw30357.pp

@@ -0,0 +1,38 @@
+program tw30357;
+
+{$mode delphi}
+
+type
+  TMyRecord = record
+  private
+    class function GetEmpty: TMyRecord; static;
+  public
+    class property Empty: TMyRecord read GetEmpty;
+  private
+    FData: IInterface;
+  end;
+
+class function TMyRecord.GetEmpty: TMyRecord; static;
+begin
+end;
+
+procedure Main2(Sender: TObject);
+var
+  v1: PtrUInt;
+begin
+  v1 := 42;
+end;
+
+procedure Main(Sender: TObject);
+var
+  v1: TMyRecord;
+begin
+  if v1.FData <> nil then
+    Halt(1);
+end;
+
+begin
+  { with Main2 we ensure that the stack area is not 0 }
+  Main2(nil);
+  Main(nil);
+end.