Prechádzať zdrojové kódy

compiler: don't write zero ClassInfo pointer even if class does not have published methods rtti (issue #14930)

git-svn-id: trunk@14004 -
paul 15 rokov pred
rodič
commit
dfdfec0201
3 zmenil súbory, kde vykonal 13 pridanie a 4 odobranie
  1. 1 0
      .gitattributes
  2. 1 4
      compiler/nobj.pas
  3. 11 0
      tests/test/tclassinfo1.pp

+ 1 - 0
.gitattributes

@@ -8188,6 +8188,7 @@ tests/test/tclass5.pp svneol=native#text/plain
 tests/test/tclass6.pp svneol=native#text/plain
 tests/test/tclass7.pp svneol=native#text/plain
 tests/test/tclass8.pp svneol=native#text/plain
+tests/test/tclassinfo1.pp svneol=native#text/pascal
 tests/test/tclrprop.pp svneol=native#text/plain
 tests/test/tcmp.pp svneol=native#text/plain
 tests/test/tcmp0.pp svneol=native#text/plain

+ 1 - 4
compiler/nobj.pas

@@ -1315,10 +1315,7 @@ implementation
             { pointer to field table }
             current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(fieldtablelabel));
             { pointer to type info of published section }
-            if (oo_can_have_published in _class.objectoptions) then
-              current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(RTTIWriter.get_rtti_label(_class,fullrtti)))
-            else
-              current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil));
+            current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(RTTIWriter.get_rtti_label(_class,fullrtti)));
             { inittable for con-/destruction }
             if _class.members_need_inittable then
               current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(RTTIWriter.get_rtti_label(_class,initrtti)))

+ 11 - 0
tests/test/tclassinfo1.pp

@@ -0,0 +1,11 @@
+program tclassinfo1;
+
+{$apptype console}
+{$mode objfpc}{$H+}
+uses
+  Classes;
+begin
+  WriteLn(TObject.ClassInfo = TypeInfo(TObject));
+  WriteLn(TPersistent.ClassInfo = TypeInfo(TPersistent));
+end.
+