I have found a possible contradiction in the working draft of standard C++. First I present the facts, and my question comes at the end.
When the integer conversion ranks are established, [conv.rank]/1.1 says
No two signed integer types [...] shall have the same integer conversion rank, even if they have the same representation.
[basic.fundamental]/8 says:
Type
wchar_t
is a distinct type that has an implementation-defined signed or unsigned integer type as its underlying type.
Finally, [conv.rank]/1.8:
The ranks of
char8_t
,char16_t
,char32_t
, andwchar_t
shall equal the ranks of their underlying types ([basic.fundamental]).
In case that wchar_t
be implemented as a signed integer type, it would have the same rank as its underlying type, which is a distinct type of some other integer type.
Thus, we have two different signed integer types with identical rank, in contradiction with [conv.rank]/1.1.
Is this an actual contradiction, or I am misunderstanding when two trivially copyable types are distinct types in C++?