https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78044
--- Comment #7 from Andrzej Krzemienski <akrzemi1 at gmail dot com> --- This still reproduces in version 7.2. Here is a Wandbox link: https://wandbox.org/permlink/5uCAr5u0xpynljhQ Here is the code, you need to compile it with -DNDEBUG -O2: ``` #include <cassert> class O { int _val; bool _init = false; public: O() = default; O(const int& i) : _val(i), _init(true) {} explicit operator bool () const { return _init; } const int& operator*() const { assert (_init); return _val; } void operator=(int const& i) { _init = true; _val = i; } }; bool equal_pointees ( O const& x, O const& y ) { return (!x) != (!y) ? false : ( !x ? true : (*x) == (*y) ) ; } O getitem(); int main(int argc, const char *[]) { O a = getitem(); O b; if (argc > 0) b = argc; if (equal_pointees(a, b)) return 1; return 0; } ``` Is there a way to give a hint to the compiler (like with an attribute) so that the warning is silenced?