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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Frank Heckenbach from comment #2)
> Maybe technically correct, but not useful to the user.

Agreed, but you asked for it with that option.

> The user's code doesn't involve pointers at all. It makes two queries about
> a span object. As the user, I don't even (and shouldn't have to) care
> whether pointer wraparound can occur in valid code on the given platform. (I
> don't think so on Linux, but I'm not even sure.)

So you shouldn't have to care about begin(c) < end(c) either, it has to be
true. But you asked the compiler to give a warning if it relies on that
assumption.

> So if it can't validly occur, GCC can assume it doesn't,

Right, it does assume that here, but you *specifically* asked to get a warning
when it assumes that.

> but won't need to
> warn.

You told it to warn!

> Note that https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html doesn't
> even mention pointers (let alone objects such as span) for -Wstrict-overflow.

You're comparing std::span iterators, and those iterators are pointers.

Reply via email to