In the following code, f(int) overload is selected instead of f(unsigned) f(int) . Tested with clang 3.0 and gcc 4.8.
enum E { }; E f(int); int f(unsigned); E e = f(E(0));
My reading of the standard makes me think that enum -> int and enum -> unsigned are identical standard conversion sequences that contain only an integral conversion.
[conv.integral] An rvalue of an enumeration type can be converted to an rvalue of an integer type.
According to [over.best.ics], the rank of a standard transformation sequence containing only an integral transformation is "Transformation".
[over.ics.rank] Two implicit conversion sequences of the same form are indistinguishable conversion sequences if one of the following rules is not applied: [...]
None of the above rules apply when comparing two standard conversion sequences.
What am I missing?
c ++ language-lawyer overloading implicit-conversion
willj
source share