AaronBallman wrote:

> > Just to confirm: is it intended that `char *s = NULL;` now generates this 
> > warning? I mean, the C library may define `NULL` as `((void*)0)`, and `char 
> > *s = ((void*)0);` is clearly not C++-compatible. However, when compiling 
> > this code in C++, `NULL` may expand to something that IS actually okay in 
> > C++ (like `0`, `nullptr` or `__null`). So this warning may be a bit too 
> > noisy overall?
> > https://gcc.godbolt.org/z/hnMfsPjsa
> 
> Hmmm, semi-intended. It's intended to diagnose `void foo(void *ptr) { char *s 
> = ptr; }`, but a null pointer constant initialization, regardless of form 
> (`nullptr`, `(void *)0`, `__null`, etc) should not be diagnosed. So I think I 
> need to be more clever here; I'll work on a fix (thought it likely won't be 
> until tomorrow at this point). Thank you for bringing this up!

https://github.com/llvm/llvm-project/pull/140724 should address this concern

https://github.com/llvm/llvm-project/pull/138271
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to