-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Full name of submitter: Brian Bi
Reference (section label): [dcl.enum]
Issue description: [dcl.enum] explains how the underlying type of an enumeration is determined, and for scoped enumerations, specifies that the enumeration has the same set of values as the underlying type. I'm quite sure that it was intended that the enumeration has the same size and alignment requirement as its underlying type, but the current wording does not explicitly state this. I'm less sure of whether (analogously to [basic.fundamental]/6) it was intended that enumerations always have the same value representation as their underlying type and that every valid value of the enumeration always has the same representation as it does in the underlying type. I think the answer to both is "yes" because otherwise it would be hard to satisfy [dcl.enum]/9 (according to which identity of underlying types is sufficient for layout-compatibility). If so, it should be made explicit. If not, perhaps it would be appropriate to add a note indicating what is not guaranteed.
Suggested resolution: Insert the following paragraph after [dcl.enum]/8:
An enumeration has the same size, value representation, and alignment requirements ([basic.align]) as its underlying type. Furthermore, each value of an enumeration has the same representation as the same value of the underlying type.