The solution should be quite simple:
fieldvs:=nil;
if token=_ID then
begin
sorg:=orgpattern;
hs:=pattern;
searchsym(hs,srsym,srsymtable);
if not(assigned(srsym) and (srsym.typ in [typesym,unitsym])) then
begin
consume(_ID);
consume(_COLON);
fieldvs:=cfieldvarsym.create(sorg,vs_value,generrordef,[]);
variantdesc^^.variantselector:=fieldvs;
symtablestack.top.insertsym(fieldvs);
end;
end;
read_anon_type(casetype,true);
Would you please file a bug report with your fix or a merge request? (Best with a test case)
In addition to that, the anonymous enumeration cannot be used without an identifier which, if it is allowed, should also be allowed without the identifier but, if allowed, would leave no way to reference the enumeration constants outside the record's definition.
If there is no selector field then you don't access these values anyway. Only if there is a field you'd have a need to use them.