浏览代码

* don't try to write rtti for fields in Pascal records/classes/objects/...
whose type is an objc type (objcclass, objcprotocol): they only need
objc-style rtti, which is generated elsewhere (and to prevent bugs
they give an internal error if we try to generate FPC-style rtti for
them) (mantis #20876)

git-svn-id: trunk@19861 -

Jonas Maebe 13 年之前
父节点
当前提交
22dd93858d
共有 3 个文件被更改,包括 23 次插入1 次删除
  1. 1 0
      .gitattributes
  2. 2 1
      compiler/ncgrtti.pas
  3. 20 0
      tests/test/packages/cocoaint/tw20876.pp

+ 1 - 0
.gitattributes

@@ -9734,6 +9734,7 @@ tests/test/packages/cocoaint/tobjc33a.pp svneol=native#text/plain
 tests/test/packages/cocoaint/tobjcnh1.pp svneol=native#text/plain
 tests/test/packages/cocoaint/tvarpara.pp svneol=native#text/plain
 tests/test/packages/cocoaint/tw16329.pp svneol=native#text/plain
+tests/test/packages/cocoaint/tw20876.pp svneol=native#text/plain
 tests/test/packages/fcl-base/tascii85.pp svneol=native#text/plain
 tests/test/packages/fcl-base/tgettext1.pp svneol=native#text/plain
 tests/test/packages/fcl-db/assertions.pas svneol=native#text/plain

+ 2 - 1
compiler/ncgrtti.pas

@@ -171,7 +171,8 @@ implementation
                (
                 (rt=fullrtti) or
                 tfieldvarsym(sym).vardef.needs_inittable
-               ) then
+               ) and
+               not is_objc_class_or_protocol(tfieldvarsym(sym).vardef) then
               begin
                 current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(ref_rtti(tfieldvarsym(sym).vardef,rt)));
                 current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(tfieldvarsym(sym).fieldoffset));

+ 20 - 0
tests/test/packages/cocoaint/tw20876.pp

@@ -0,0 +1,20 @@
+{ %norun }
+
+unit tw20876;
+
+{$mode delphi}
+{$modeswitch objectivec1}
+
+interface
+
+uses
+  CocoaAll;
+
+type
+  arecord = record
+    astr: NSString;
+  end;
+
+implementation
+
+end.