[cfe-dev] bug? comparison of distinct pointer types ('void *' and 'void *')
Scott R Parish
srp at srparish.net
Sat Oct 24 15:22:10 PDT 2009
Doing "ptr == 0" seems to work fine, but doing "ptr == (void *)0" (which
NULL expands to on my platform) doesn't. This is using the just release
llvm+clang linux 64bit binary version of clang.
[0]/tmp$ cat /tmp/ptrcmp.c
#include <stdio.h>
int
is_null(void *ptr)
{
return ptr == NULL;
}
[0]/tmp$ clang -o /tmp/ptrcmp.o -c /tmp/ptrcmp.c
/tmp/ptrcmp.c:6:13: warning: comparison of distinct pointer types
('void *' and 'void *')
return ptr == NULL;
~~~ ^ ~~~~
1 diagnostic generated.
[0]/tmp$
More information about the cfe-dev
mailing list