The following example:
char *var = (int)0;
Compiles to gcc and cl.exe, but causes an error in clang:
cannot initialize a variable of type 'char *' with rvalue of type 'int'
Who is right here?
What is it worth, C ++ 11 says (emphasis mine)
4.10 / 1
The null pointer constant is an integer expression const (5.19) prvalue of an integer type that evaluates to zero or a prdue of type std :: nullptr_t. The null pointer constant can be converted to a pointer type; the result is a null pointer value of this type and ...
and
5.19 / 3
. [: (8.3.4, 5.3.4) (9.6) , (7.2), (4.10), (7.6.2). - ]
, , . cl.exe ( ), gcc . , , gcc?