The reference says:
If there is no data attached to any of the variants of an enumeration, then the discriminant can be directly chosen and accessed.
These enumerations can be cast to integer types with the
asoperator by a numeric cast. The enumeration can optionally specify which integer each discriminant gets by following the variant name with
=followed by a constant expression. If the first variant in the declaration is unspecified, then it is set to zero. For every other unspecified discriminant, it is set to one higher than the previous variant in the declaration.
In the community discord it came up that it's ambiguous whether this means that:
- the first variant of a flat enum is always guaranteed to be zero (unless set)
- the first variant of a flat enum is always guaranteed to be zero (unless set) if the
=syntax is used at least once in the enum definition
Is this defined, and if so, which interpretation is correct?