mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 13:19:12 +02:00
* fix #40504: always provide the global enum symbol for anonymous enum types (e.g. as part of a set)
+ added test
This commit is contained in:
parent
032cbc54a7
commit
3f1d62af8e
@ -1789,7 +1789,9 @@ implementation
|
|||||||
else
|
else
|
||||||
Message(parser_e_enumeration_out_of_range);
|
Message(parser_e_enumeration_out_of_range);
|
||||||
tenumsymtable(aktenumdef.symtable).insertsym(cenumsym.create(s,aktenumdef,longint(l.svalue)));
|
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)));
|
tstoredsymtable(aktenumdef.owner).insertsym(cenumsym.create(s,aktenumdef,longint(l.svalue)));
|
||||||
current_tokenpos:=storepos;
|
current_tokenpos:=storepos;
|
||||||
end;
|
end;
|
||||||
|
17
tests/webtbs/tw40504.pp
Normal file
17
tests/webtbs/tw40504.pp
Normal 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.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user