* fix for Mantis #30626: unset current_procinfo so that further specializations don't use a symtable to specialize themselves in that they shouldn't use (cause current_procinfo takes precedence)

git-svn-id: trunk@34916 -
This commit is contained in:
svenbarth 2016-11-18 16:17:09 +00:00
parent 0e7a9ad375
commit 63b0024e4c
3 changed files with 41 additions and 0 deletions

1
.gitattributes vendored
View File

@ -15245,6 +15245,7 @@ tests/webtbs/tw30537.pp svneol=native#text/pascal
tests/webtbs/tw30552.pp svneol=native#text/pascal
tests/webtbs/tw30570.pp svneol=native#text/plain
tests/webtbs/tw30572.pp svneol=native#text/plain
tests/webtbs/tw30626.pp svneol=native#text/pascal
tests/webtbs/tw3063.pp svneol=native#text/plain
tests/webtbs/tw3064.pp svneol=native#text/plain
tests/webtbs/tw30666.pp svneol=native#text/plain

View File

@ -713,6 +713,7 @@ uses
old_current_structdef : tabstractrecorddef;
old_current_specializedef,
old_current_genericdef : tstoreddef;
old_current_procinfo : tprocinfo;
hmodule : tmodule;
oldcurrent_filepos : tfileposinfo;
recordbuf : tdynamicarray;
@ -908,6 +909,9 @@ uses
old_current_specializedef:=nil;
old_current_genericdef:=nil;
old_current_structdef:=nil;
old_current_procinfo:=current_procinfo;
current_procinfo:=nil;
if parse_class_parent then
begin
@ -1082,6 +1086,7 @@ uses
end;
block_type:=old_block_type;
current_procinfo:=old_current_procinfo;
if parse_class_parent then
begin
current_structdef:=old_current_structdef;

35
tests/webtbs/tw30626.pp Normal file
View File

@ -0,0 +1,35 @@
{ %NORUN }
program tw30626;
{$mode objfpc}
type
generic IBase<T> = interface(IUnknown)
end;
generic TBase<T> = class(TInterfacedObject, specialize IBase<T>)
public
function Test: specialize IBase<T>;
end;
generic TDerived<T> = class(specialize TBase<T>)
end;
function TBase.Test: specialize IBase<T>;
begin
result := (specialize TDerived<T>).Create;
end;
type
TIntDerived = specialize TDerived<Integer>;
var
t: TIntDerived;
begin
t := TIntDerived.Create;
t.Test;
end.