mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-05 01:38:03 +02:00
* fix #40979: don't recurse further into the nested hierarchy for code generation if the function is generic
+ added test
This commit is contained in:
parent
5c6abd2e51
commit
599b187589
@ -1624,7 +1624,8 @@ implementation
|
||||
hpi:=tcgprocinfo(get_first_nestedproc);
|
||||
while assigned(hpi) do
|
||||
begin
|
||||
hpi.generate_code_tree;
|
||||
if not (df_generic in hpi.procdef.defoptions) then
|
||||
hpi.generate_code_tree;
|
||||
hpi:=tcgprocinfo(hpi.next);
|
||||
end;
|
||||
resetprocdef;
|
||||
|
26
tests/webtbs/tw40979.pp
Normal file
26
tests/webtbs/tw40979.pp
Normal file
@ -0,0 +1,26 @@
|
||||
program tw40979;
|
||||
{$mode ObjFPC}
|
||||
|
||||
procedure AddGroup(out aArg: Integer);
|
||||
|
||||
generic procedure Add<T>(const X : T; const Y : T; out Z : T);
|
||||
begin
|
||||
Z:=X+Y;
|
||||
end;
|
||||
|
||||
var
|
||||
R : integer;
|
||||
|
||||
begin
|
||||
specialize Add<integer>(4,5,R);
|
||||
aArg := R;
|
||||
end;
|
||||
|
||||
var
|
||||
r : integer;
|
||||
begin
|
||||
AddGroup(r);
|
||||
if r <> 9 then
|
||||
Halt(1);
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user