https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79961
--- Comment #7 from Pedro Alves <palves at redhat dot com> --- Funny enough, clang 3.7 (don't have more recent handy), warns in that case, while it errors on the "this" arg: nonnull.cc:3:39: error: '__nonnull__' attribute is invalid for the implicit this argument A (const char *arg) __attribute__ ((__nonnull__ (1))); ^ ~ nonnull.cc:4:46: error: '__nonnull__' attribute is invalid for the implicit this argument void foo (const char *arg) __attribute__ ((__nonnull__ (1))); ^ ~ nonnull.cc:5:51: warning: '__nonnull__' attribute only applies to pointer arguments [-Wignored-attributes] void foo (int, const char *arg) __attribute__ ((__nonnull__ (2))); ~~~ ^ ~ 1 warning and 2 errors generated. So nobody's consistent. :-)