mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-04 04:50:30 +02:00
* fix #39736: ensure that the capturer object and any converted function reference interface are considered used
+ added test
This commit is contained in:
parent
02211971a3
commit
f73fc7d566
@ -334,6 +334,7 @@ implementation
|
||||
|
||||
symowner.insertsym(sym);
|
||||
symowner.insertdef(result);
|
||||
addsymref(sym);
|
||||
end;
|
||||
|
||||
|
||||
@ -446,6 +447,7 @@ implementation
|
||||
typesym.fileinfo:=pd.fileinfo;
|
||||
st.insertdef(def);
|
||||
st.insertsym(typesym);
|
||||
addsymref(typesym);
|
||||
|
||||
if df_generic in pd.defoptions then
|
||||
include(def.defoptions,df_generic);
|
||||
|
28
tests/webtbs/tw39736.pp
Normal file
28
tests/webtbs/tw39736.pp
Normal file
@ -0,0 +1,28 @@
|
||||
{ %NORUN }
|
||||
|
||||
program tw39736;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
{$ModeSwitch functionreferences}
|
||||
{$ModeSwitch anonymousfunctions}
|
||||
|
||||
{$warn 5028 error}
|
||||
|
||||
type
|
||||
TProc = reference to procedure;
|
||||
|
||||
var
|
||||
p: TProc;
|
||||
procedure Fly(w: word);
|
||||
begin
|
||||
p:=procedure
|
||||
begin
|
||||
writeln('TBird.Fly w=',w);
|
||||
end;
|
||||
p();
|
||||
end;
|
||||
|
||||
begin
|
||||
Fly(3);
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user