https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111087
--- Comment #5 from Adam Badura <adam.f.badura at gmail dot com> ---
(In reply to Andrew Pinski from comment #3)
> The warning is correct as tags.end() and tags.begin() will always be a
> nullptr for std::array<T, 0>
Yes. But what does it change?
`std::lower_bound` gets an empty range (begin == end) and hence will return the
`end` value. Then we check `result != tags.end()` which should cut off since it
will be false and hence we will never reach the place where we use
`result->`...
Let me add, that the issue is not about short-circuiting since it also shows in
the elaborate form:
if (result != tags.end())
{
return result->compare(tag) == 0;
}
else
{
return false;
}