This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
[Moved to DR at the September, 2013 meeting.]
According to 7.3.7 [conv.prom] paragraph 4,
A prvalue of an unscoped enumeration type whose underlying type is fixed (9.7.1 [dcl.enum]) can be converted to a prvalue of its underlying type. Moreover, if integral promotion can be applied to its underlying type, a prvalue of an unscoped enumeration type whose underlying type is fixed can also be converted to a prvalue of the promoted underlying type.
Because both of these conversions have the same rank, a call like the following is ambiguous, even though conversion to the underlying type might seem better than conversion to int:
enum E : char { e };
void f(char);
void f(int);
void g() {
f(e); // ambiguous
}
On the other hand, character types often have non-numeric semantics in programs, and programmers might use a character type just to set the size of the enumeration's object representation, not to imply character semantics for the enumeration. It might be better to leave the ambiguity in place in order to require programmers to make their intent explicit.
Proposed resolution (June, 2013):
Change 12.2.4.3 [over.ics.rank] paragraph 4 as follows:
...Two conversion sequences with the same rank are indistinguishable unless one of the following rules applies:
A conversion that does not convert a pointer, a pointer to member, or std::nullptr_t to bool is better than one that does.
A conversion that promotes an enumeration whose underlying type is fixed to its underlying type is better than one that promotes to the promoted underlying type, if the two are different.
If class B is derived...