* 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 -
This commit is contained in:
svenbarth 2017-01-07 14:35:25 +00:00
parent 4b7d0eb0ac
commit 6b641394d0
3 changed files with 32 additions and 0 deletions

1
.gitattributes vendored
View File

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

View File

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

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