mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 20:39:28 +02:00
fcl-passrc: fixed stackoverflow on const a=a, #39258
This commit is contained in:
parent
440af0f81f
commit
e4356a0d38
@ -10325,6 +10325,9 @@ begin
|
||||
FindData.Found:=DeclEl;
|
||||
end;
|
||||
|
||||
if (DeclEl is TPasVariable) and El.HasParent(DeclEl) then
|
||||
RaiseIdentifierNotFound(20230712105546,aName,El);
|
||||
|
||||
Ref:=CreateReference(DeclEl,El,Access,@FindData);
|
||||
CheckFoundElement(FindData,Ref);
|
||||
|
||||
|
@ -205,6 +205,7 @@ type
|
||||
Procedure TestVarInitConst;
|
||||
Procedure TestVarOfVarFail;
|
||||
Procedure TestConstOfVarFail;
|
||||
Procedure TestConstSelfFail;
|
||||
Procedure TestTypedConstWrongExprFail;
|
||||
Procedure TestVarWrongExprFail;
|
||||
Procedure TestArgWrongExprFail;
|
||||
@ -2928,6 +2929,15 @@ begin
|
||||
CheckParserException('Expected type, but got variable',PParser.nParserExpectedTypeButGot);
|
||||
end;
|
||||
|
||||
procedure TTestResolver.TestConstSelfFail;
|
||||
begin
|
||||
StartProgram(false);
|
||||
Add('const');
|
||||
Add(' a = a;');
|
||||
Add('begin');
|
||||
CheckResolverException('identifier not found "a"',nIdentifierNotFound);
|
||||
end;
|
||||
|
||||
procedure TTestResolver.TestTypedConstWrongExprFail;
|
||||
begin
|
||||
StartProgram(false);
|
||||
|
Loading…
Reference in New Issue
Block a user