可能是C++工作草案措辞上的缺陷(整数转换等级规则)

Probably defect in wording of C++ working draft (integer conversion rank rules)

我发现 working draft of standard C++ 中可能存在矛盾。我先陈述事实,最后才是我的问题

整数转换等级成立时,[conv.rank]/1.1表示

No two signed integer types [...] shall have the same integer conversion rank, even if they have the same representation.

[basic.fundamental]/8 说:

Type wchar_t is a distinct type that has an implementation-defined signed or unsigned integer type as its underlying type.

最后,[conv.rank]/1.8

The ranks of char8_t, char16_t, char32_t, and wchar_t shall equal the ranks of their underlying types ([basic.fundamental]).

如果 wchar_t 被实现为 有符号整数类型 ,它将具有与其底层相同的等级类型,它是其他一些整数类型的不同类型。

因此,我们有两个具有相同等级的不同有符号整数类型,这与 [conv.rank]/1.1 相矛盾。

这是一个实际的矛盾,还是我误会了 C++ 中两个普通可复制类型是不同的类型?

we have two different signed integer types

我在标准中看不到任何地方说 wchar_t 是“有符号整数类型”。或“无符号整数类型”。我看到哪里 it says that it is an "integer type":

Types bool, char, wchar_­t, char8_­t, char16_­t, char32_­t, and the signed and unsigned integer types are collectively called integral types. A synonym for integral type is integer type.

但“有符号整数类型”的定义不包括wchar_t。也就是说,该标准明确允许存在既不是“有符号整数类型”也不是“无符号整数类型”的“整数类型”。

并且 [conv.rank] 中的声明不适用于此类类型。