Florian Weimer <fwei...@redhat.com> writes: > Would you be able to check whether __null is in the preprocessed > sources? If it is there (and the lack of further logged expansions > suggests this), then this is a compiler bug. __null is not zero, and > should be fine to use as a null pointer constant. This is why NULL is > not defined as 0.
I can reproduce this without any preprocessing with clang 9, 10, and 11. % cat foo.cc int foo(char* msg_ctxt_id) { return msg_ctxt_id == __null; } % clang++-11 -Wzero-as-null-pointer-constant -c foo.cc foo.cc:3:25: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant] return msg_ctxt_id == __null; ^~~~~~ nullptr 1 warning generated. % clang++-10 -Wzero-as-null-pointer-constant -c foo.cc foo.cc:3:25: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant] return msg_ctxt_id == __null; ^~~~~~ nullptr 1 warning generated. % clang++-9 -Wzero-as-null-pointer-constant -c foo.cc foo.cc:3:25: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant] return msg_ctxt_id == __null; ^~~~~~ nullptr 1 warning generated. -- Alexandre Duret-Lutz