https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79961
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org --- Comment #8 from Martin Sebor <msebor at gcc dot gnu.org> --- Consider the following test case. If the decision is to allow A::g, it would be helpful if the warning on calls to it made it clear which argument it's referring to: the implicit this or the same argument 1 as that in the calls to the other two functions. $ cat t.C && gcc -S -Wall -Wextra -Wpedantic t.C typedef void F (void*) __attribute__ ((__nonnull__ (1))); F f; struct A { F g; static F h; }; void foo (void *p) { f (0); ((A*)0)->g (p); A::h (0); } t.C: In function ‘void foo(void*)’: t.C:13:7: warning: null argument where non-null required (argument 1) [-Wnonnul] f (0); ^ t.C:15:16: warning: null argument where non-null required (argument 1) [-Wnonnull] ((A*)0)->g (p); ^ t.C:17:10: warning: null argument where non-null required (argument 1) [-Wnonnull] A::h (0); ^