mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 17:59:25 +02:00
* fix for Mantis #37844: prefer to use the symtable determined in generate_specialization_phase1 for procdefs as that might a withsymtable that is needed to correctly load Self later on
+ added test git-svn-id: trunk@47101 -
This commit is contained in:
parent
2f877218b4
commit
e90cf131fe
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -18488,6 +18488,7 @@ tests/webtbs/tw3780.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw37806.pp svneol=native#text/pascal
|
tests/webtbs/tw37806.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw3782.pp svneol=native#text/plain
|
tests/webtbs/tw3782.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw37823.pp svneol=native#text/pascal
|
tests/webtbs/tw37823.pp svneol=native#text/pascal
|
||||||
|
tests/webtbs/tw37844.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw3796.pp svneol=native#text/plain
|
tests/webtbs/tw3796.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3805.pp svneol=native#text/plain
|
tests/webtbs/tw3805.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3814.pp svneol=native#text/plain
|
tests/webtbs/tw3814.pp svneol=native#text/plain
|
||||||
|
@ -3032,6 +3032,9 @@ implementation
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
srsym:=tprocdef(hdef).procsym;
|
srsym:=tprocdef(hdef).procsym;
|
||||||
|
if assigned(spezcontext.symtable) then
|
||||||
|
srsymtable:=spezcontext.symtable
|
||||||
|
else
|
||||||
srsymtable:=srsym.owner;
|
srsymtable:=srsym.owner;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
|
40
tests/webtbs/tw37844.pp
Normal file
40
tests/webtbs/tw37844.pp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
program tw37844;
|
||||||
|
{$mode objfpc}
|
||||||
|
|
||||||
|
type
|
||||||
|
trec = record
|
||||||
|
value: longint;
|
||||||
|
end;
|
||||||
|
{generic grec<T> = record
|
||||||
|
value: T;
|
||||||
|
end;}
|
||||||
|
|
||||||
|
tmytype = class
|
||||||
|
public
|
||||||
|
generic function func1<T>( const v: longint ): trec;//specialize grec<T>;
|
||||||
|
end;
|
||||||
|
|
||||||
|
generic function tmytype.func1<T>( const v: longint ): trec;//specialize grec<T>;
|
||||||
|
begin
|
||||||
|
result.value := v;
|
||||||
|
//result.value := t(v);
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
tmp: tmytype;
|
||||||
|
gr: trec;//specialize grec<string>;
|
||||||
|
vr: longint;//variant;
|
||||||
|
|
||||||
|
begin
|
||||||
|
tmp := tmytype.Create;
|
||||||
|
vr := 123;
|
||||||
|
gr := Default(trec);
|
||||||
|
with tmp do
|
||||||
|
gr := specialize func1<string>( vr ); // <--!!!!!!!!!!!!!!!!!!!
|
||||||
|
//gr := tmp.specialize func1<string>(vr);
|
||||||
|
//writeln(gr.value);
|
||||||
|
tmp.Free;
|
||||||
|
if gr.value<>vr then
|
||||||
|
halt(1);
|
||||||
|
//readln;
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user