- 论坛徽章:
- 17
|
回复 5# bruceteen
数学字面量(integer literal)的类型为能包含其值的整型类型,不能隐式进行CV转换。关于integer literal的描述细则如下:
The type of an integer literal depends on its form, value, and suffix. If it is decimal and has no suffix, it has
the first of these types in which its value can be represented: int, long int; if the value cannot be represented
as a long int, the behavior is undefined. If it is octal or hexadecimal and has no suffix, it has the
first of these types in which its value can be represented: int, unsigned int, long int, unsigned
long int. If it is suffixed by u or U, its type is the first of these types in which its value can be represented:
unsigned int, unsigned long int. If it is suffixed by l or L, its type is the first of these
types in which its value can be represented: long int, unsigned long int. If it is suffixed by ul,
lu, uL, Lu, Ul, lU, UL, or LU, its type is unsigned long int.
根据上面的规定可知0类型为int,与const int不匹配,又由于0是个临时对象其为rvalue,所以无法进行匹配转换。 |
|