https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77298
--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> --- I should add that Clang issues the warning for all three functions: $ /build/llvm-trunk/bin/clang -S -Wall -Wextra -Wpedantic z.C z.C:2:21: warning: 'this' pointer cannot be null in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion] int f () { return this ? 1 : 0; } ^~~~ ~ z.C:6:21: warning: 'this' pointer cannot be null in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion] int f () { return this ? 1 : 0; } ^~~~ ~ z.C:13:22: warning: 'this' pointer cannot be null in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion] int C::f () { return this ? 1 : 0; } ^~~~ ~ 3 warnings generated.