This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/79961] Should diagnose when '__nonnull__' attribute is applied to implicit this argument
- From: "palves at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 08 Mar 2017 23:13:58 +0000
- Subject: [Bug c++/79961] Should diagnose when '__nonnull__' attribute is applied to implicit this argument
- Auto-submitted: auto-generated
- References: <bug-79961-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79961
--- Comment #6 from Pedro Alves <palves at redhat dot com> ---
I remembered to check what does G++ say when you apply the nonnull to a
non-pointer argument. We get a hard error:
$ /opt/gcc/bin/g++ nonnull.cc -o nonnull -c
nonnull.cc:5:67: error: nonnull argument references non-pointer operand
(argument 1, operand 2)
void foo (int, const char *arg) __attribute__ ((__nonnull__ (2)));
^
I think this sets precedent for a hard error on the implicit "this" argument.