The code is correct, the compiler does not comply with the standard that says it (section [expr.eq]using the wording from C ++ 0x draft n3225, but it should be the same in other versions):
any pointer to an element can be compared with a null pointer constant
and
, . , , .
( [conv.ptr], std::nullptr_t ++ 0x):
(5.19) prvalue , std::nullptr_t.
( [expr.const]):
, .
. ----, , , 0 . assert , , - .
Apple, -, . , , assert((intptr_t)p != 0) - .
, .
EDIT: , , ( [conv.mem]):
(4.10) ; , .