Переглянути джерело

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

Sven/Sarah Barth 1 рік тому
батько
коміт
3f1d62af8e
2 змінених файлів з 20 додано та 1 видалено
  1. 3 1
      compiler/ptype.pas
  2. 17 0
      tests/webtbs/tw40504.pp

+ 3 - 1
compiler/ptype.pas

@@ -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 - 0
tests/webtbs/tw40504.pp

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