* ensure that a procvar (especially a "REFERENCE TO") begins either with FUNCTION or PROCEDURE

+ added test
This commit is contained in:
Sven/Sarah Barth 2023-03-15 23:35:30 +01:00
parent 7909f00c83
commit c1ecfc323a
2 changed files with 18 additions and 1 deletions

View File

@ -1584,7 +1584,10 @@ implementation
olddef:=nil;
is_func:=(token=_FUNCTION);
consume(token);
if token in [_FUNCTION,_PROCEDURE] then
consume(token)
else
consume(_FUNCTION);
pd:=cprocvardef.create(normal_function_level,doregister);
if assigned(sym) then

14
tests/tbf/tb0297.pp Normal file
View File

@ -0,0 +1,14 @@
{ %FAIL }
program tb0297;
{$mode objfpc}
{$modeswitch functionreferences}
type
TTestProc = procedure;
TTestProcRef = reference to TTestProc;
begin
end.