https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111087
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Adam Badura from comment #7)
> So, the cases I described here _is_ a false-positive, however, an expected
> one. Do I understand this correctly?
> It _does not_ generate the warning. So, what prevents generating the warning
> here? How do I formulate the code to avoid the warning?
This does though:
bool foo()
{
const auto a = (class1*)nullptr;
return a != nullptr && a->method1();
}