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

palves at redhat dot com gcc-bugzilla@gcc.gnu.org
Thu Mar 9 00:50:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79961

--- Comment #9 from Pedro Alves <palves at redhat dot com> ---
>  ((A*)0)->g (p)

This is undefined behavior.  We forced the world to fix code like that in the
GCC 6 release cycle: https://gcc.gnu.org/gcc-6/changes.html

At best, I'd suggest degrading the error on implicit this nonnull(1) to a
warning iff compiling with -fno-delete-null-pointer-checks.  But I don't think
we really should need to cater to that.  FWIW.


More information about the Gcc-bugs mailing list