This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/81928] if(!this) optimization leads to possible errors without warnings
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 23 Aug 2017 08:27:18 +0000
- Subject: [Bug c++/81928] if(!this) optimization leads to possible errors without warnings
- Auto-submitted: auto-generated
- References: <bug-81928-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81928
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Matthieu Brucher from comment #2)
> Comparing this to anything from Null to nullptr should be an error, not be
> silently passed.
No, it can't be rejected, because it's valid code. Just like "if (!true)" is
valid code. Just because it's pointless and maybe a mistake or a bug doesn't
mean we can reject it.