This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/79961] Should diagnose when '__nonnull__' attribute is applied to implicit this argument


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.  :-)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]