Răsfoiți Sursa

* fix for Mantis #31201: don't write any RTTI for undefined defs (and while we're at it abort if an error def is encountered)

+ added test

git-svn-id: trunk@35256 -
svenbarth 8 ani în urmă
părinte
comite
6b641394d0
3 a modificat fișierele cu 32 adăugiri și 0 ștergeri
  1. 1 0
      .gitattributes
  2. 6 0
      compiler/ncgrtti.pas
  3. 25 0
      tests/webtbs/tw31201.pp

+ 1 - 0
.gitattributes

@@ -15334,6 +15334,7 @@ tests/webtbs/tw3109.pp svneol=native#text/plain
 tests/webtbs/tw3111.pp svneol=native#text/plain
 tests/webtbs/tw31120.pp svneol=native#text/pascal
 tests/webtbs/tw3113.pp svneol=native#text/plain
+tests/webtbs/tw31201.pp svneol=native#text/pascal
 tests/webtbs/tw3124.pp svneol=native#text/plain
 tests/webtbs/tw3131.pp svneol=native#text/plain
 tests/webtbs/tw3137.pp svneol=native#text/plain

+ 6 - 0
compiler/ncgrtti.pas

@@ -136,6 +136,12 @@ implementation
                   if assigned(tprocdef(def).parast) then
                     write_persistent_type_info(tprocdef(def).parast,false);
                 end;
+              errordef:
+                { we shouldn't have come this far if we have an errordef somewhere }
+                internalerror(2017010701);
+              undefineddef:
+                { don't write any RTTI for these }
+                continue;
             end;
             { always generate persistent tables for types in the interface so
               they can be reused in other units and give always the same pointer

+ 25 - 0
tests/webtbs/tw31201.pp

@@ -0,0 +1,25 @@
+unit tw31201;
+
+{$mode delphi}{$H+}
+
+interface
+
+type
+  Tuple<T> = record
+    Item1: T;
+  end;
+
+  Tuple = record
+    class function Create<T>(Item1: T): Tuple<T>; overload; static;
+  end;
+
+implementation
+
+class function Tuple.Create<T>(Item1: T): Tuple<T>;
+begin
+  Result.Item1:=Item1;
+end;
+
+initialization
+  Writeln(Tuple.Create<LongInt>(42).Item1);
+end.