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++/81928] if(!this) optimization leads to possible errors without warnings


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

--- Comment #19 from Matthieu Brucher <matthieu.brucher at gmail dot com> ---
That was my original comment... Thanks for quoting me...
The issue is that the warning doesn't tell me what you told me, that "this" is
never equal to nullptr in that context. This is what the warning should be (and
as such, yes, it is a bug).

This change in behavior (this is always different from nullptr) was introduced
in gcc 6. Any version before would still check that the condition is true, so
GCC behaves better now, handling better the case than before, but it still
needs to educate people that what they are doing is wrong.

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