mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-11 15:51:08 +01:00
* fix #39857: don't trash symbols marked as vo_is_internal
+ added test
This commit is contained in:
parent
8595c927a8
commit
5135b586cb
@ -788,7 +788,7 @@ implementation
|
|||||||
(vo_is_funcret in tabstractnormalvarsym(p).varoptions)
|
(vo_is_funcret in tabstractnormalvarsym(p).varoptions)
|
||||||
)
|
)
|
||||||
) and
|
) and
|
||||||
not (vo_is_parentfp in tabstractnormalvarsym(p).varoptions) and
|
(tabstractnormalvarsym(p).varoptions*[vo_is_parentfp,vo_is_internal]=[]) and
|
||||||
not assigned(tabstractnormalvarsym(p).defaultconstsym);
|
not assigned(tabstractnormalvarsym(p).defaultconstsym);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
31
tests/webtbs/tw39857.pp
Normal file
31
tests/webtbs/tw39857.pp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{ %OPT = -gt }
|
||||||
|
|
||||||
|
program tw39857;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
{$ModeSwitch anonymousfunctions}
|
||||||
|
{$ModeSwitch functionreferences}
|
||||||
|
|
||||||
|
type
|
||||||
|
TProc = reference to procedure;
|
||||||
|
|
||||||
|
procedure problem(aParam1: integer; aParam2: integer; aParam3: TProc);
|
||||||
|
begin
|
||||||
|
Writeln(aParam1, aParam2);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure noproblem(aParam1: integer; aParam2: integer; aParam3: IUnknown);
|
||||||
|
begin
|
||||||
|
Writeln(aParam1, aParam2);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure test;
|
||||||
|
begin
|
||||||
|
noproblem(1, 2, TInterfacedObject.Create); // ok
|
||||||
|
problem(3,4, nil); // ok
|
||||||
|
problem(5,6, procedure begin Writeln('x'); end); // aParam3 is trashed
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
test;
|
||||||
|
end.
|
||||||
Loading…
Reference in New Issue
Block a user