mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 10:06:23 +02:00
* 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:
parent
f8c23c84b6
commit
52673d34f1
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -15300,6 +15300,7 @@ tests/webtbs/tw30978.pp svneol=native#text/pascal
|
|||||||
tests/webtbs/tw30978a.pp svneol=native#text/pascal
|
tests/webtbs/tw30978a.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw3101.pp svneol=native#text/plain
|
tests/webtbs/tw3101.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw31029.pp svneol=native#text/pascal
|
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/tw3104.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw31076.pp svneol=native#text/pascal
|
tests/webtbs/tw31076.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw3109.pp svneol=native#text/plain
|
tests/webtbs/tw3109.pp svneol=native#text/plain
|
||||||
|
@ -3395,7 +3395,7 @@ const
|
|||||||
exit;
|
exit;
|
||||||
if not foundretdef then
|
if not foundretdef then
|
||||||
begin
|
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 }
|
{ for specializations we're happy with equal defs instead of exactly the same defs }
|
||||||
result:=equal_defs(fwpd.returndef,currpd.returndef)
|
result:=equal_defs(fwpd.returndef,currpd.returndef)
|
||||||
else
|
else
|
||||||
|
38
tests/webtbs/tw31033.pp
Normal file
38
tests/webtbs/tw31033.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user