* fix for Mantis #31033: don't check for is_specialization(), but for df_specialization (this way we also get pointers or nested types that aren't by themselves real specializations)

+ added test

git-svn-id: trunk@35092 -
This commit is contained in:
svenbarth 2016-12-09 16:22:14 +00:00
parent f8c23c84b6
commit 52673d34f1
3 changed files with 40 additions and 1 deletions

1
.gitattributes vendored
View File

@ -15300,6 +15300,7 @@ tests/webtbs/tw30978.pp svneol=native#text/pascal
tests/webtbs/tw30978a.pp svneol=native#text/pascal
tests/webtbs/tw3101.pp svneol=native#text/plain
tests/webtbs/tw31029.pp svneol=native#text/pascal
tests/webtbs/tw31033.pp svneol=native#text/pascal
tests/webtbs/tw3104.pp svneol=native#text/plain
tests/webtbs/tw31076.pp svneol=native#text/pascal
tests/webtbs/tw3109.pp svneol=native#text/plain

View File

@ -3395,7 +3395,7 @@ const
exit;
if not foundretdef then
begin
if tstoreddef(fwpd.returndef).is_specialization and tstoreddef(currpd.returndef).is_specialization then
if (df_specialization in tstoreddef(fwpd.returndef).defoptions) and (df_specialization in tstoreddef(currpd.returndef).defoptions) then
{ for specializations we're happy with equal defs instead of exactly the same defs }
result:=equal_defs(fwpd.returndef,currpd.returndef)
else

38
tests/webtbs/tw31033.pp Normal file
View File

@ -0,0 +1,38 @@
{ %NORUN }
program tw31033;
{$MODESWITCH RESULT}
{$MODESWITCH ADVANCEDRECORDS}
Type
generic TGData<T> = record
public type
// FIXME: Compiler bug, details see:
// http://lists.freepascal.org/pipermail/fpc-pascal/2016-November/049444.html [^]
TSelf = specialize TGData<T>;
PSelf = ^TSelf;
public
d: T;
n: PSelf
end;
generic Function Init<T>: specialize TGData<T>.PSelf; forward;
generic Function Init<T>: specialize TGData<T>.PSelf;
Begin
new(result);
result^.d := default(T);
result^.n := nil
End;
var
t: ^specialize TGData<LongInt>;
Begin
t := specialize Init<LongInt>;
dispose(t);
End.