* fix : always provide the global enum symbol for anonymous enum types (e.g. as part of a set)

+ added test
This commit is contained in:
Sven/Sarah Barth 2023-11-07 20:33:55 +01:00
parent 032cbc54a7
commit 3f1d62af8e
2 changed files with 20 additions and 1 deletions
compiler
tests/webtbs

View File

@ -1789,7 +1789,9 @@ implementation
else
Message(parser_e_enumeration_out_of_range);
tenumsymtable(aktenumdef.symtable).insertsym(cenumsym.create(s,aktenumdef,longint(l.svalue)));
if not (cs_scopedenums in current_settings.localswitches) then
if not (cs_scopedenums in current_settings.localswitches) or
{ also provide the global symbol for anonymous enums }
not assigned(newsym) then
tstoredsymtable(aktenumdef.owner).insertsym(cenumsym.create(s,aktenumdef,longint(l.svalue)));
current_tokenpos:=storepos;
end;

17
tests/webtbs/tw40504.pp Normal file
View File

@ -0,0 +1,17 @@
{ %NORUN }
program tw40504;
{$scopedenums on}
Type
TSet = set of (a,b);
var
S : TSet;
begin
S:=[];
Include(S,a);
end.