[clang] [C] Update -Wimplicit-void-ptr-cast for null pointer constants (PR #138271)

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Mon May 19 12:15:09 PDT 2025


alexfh 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 `__null`). So this warning may be a bit too noisy overall?

https://gcc.godbolt.org/z/hnMfsPjsa

https://github.com/llvm/llvm-project/pull/138271


More information about the cfe-commits mailing list