Enumeration type compatibility compatible with their base type?

I am looking at n3690 , a draft of the upcoming C++14 standard, and I see in section 7.2 paragraph 9 :

Two enumeration types are compatible with layouts if they have the same base type.

However, I cannot find anything that suggests that the enumeration type is compatible with layouts with its base type. It seems obvious to me that this should be followed, given the reasonable semantics for what the "base type" means, but is it really guaranteed by the standard?

+3
source share
1 answer

NO, there is no black letter in the standard that indicates this. The closest you can get is point 7 of the same paragraph

7 [...] the base type is an integral type that can represent all the enumeration values ​​defined in the enumeration. If the integral type can represent all counter values, the enumeration is poorly formed. [...]

In addition, 4.5 Integral shares [conv.prom] say

4 The value of a class of non-enumerated enumeration, the base type of which fi (x) (7.2) can be converted to a prvalue of its base type.

As noted in the comments, there may exist (insidious IMO) implementations that have different endianess between the enumeration and its base type. This will be a matter of quality of execution. For all practical purposes, expect compatibility with layouts.

+2
source

All Articles