https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91127
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- The function that validates attribute positional arguments doesn't consider the subtleties of C++ member functions so the diagnostic it gives in these cases is confusing. I agree that the nonnull attribute doesn't make sense for the this pointer. Clang gives an error when nonnull is applied to this, so changing GCC to issue a warning (if not error) would seem appropriate. Putting the implicit this argument in member functions at number 1 when in non-members it refers to the first explicit argument seems like an unfortunate design flaw. But it goes back many years so I also agree it wouldn't be safe to change today. I suspect the implicit int argument in ctors was never considered. I would think it should be possible to skip without breaking too much code. Clang handles the test case correctly and so should GCC. The change from error for attribute nonnull to warning was just the result of factoring the positional argument checking out of individual attribute handlers and into a common function. Attributes alloc_align and alloc_size issued a warning, and attribute nonnull an error, so I went with the former. Tightening it to an error in GCC 10 to match Clang sounds like a good change.