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

--- Comment #18 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #16)
> Span is a view, so it is like reference-wrapper. The lifetime of the
> underlying data is not tied to the lifetime of the Span.

Aha, I could add a check for std::span but that wouldn't help, because here
it's a custom-made Span.  And I don't think there's a pattern I could look for
that would tell us "this is a std::span-like class".  :/

(In reply to Barnabás Pőcze from comment #17)
> The simple test case with std::span still triggers the warning:
> https://gcc.godbolt.org/z/43cKxdqr3. I feel that without deeper code
> analysis such a warning will generate too many false positives and people
> will simply turn it off.

There really haven't been that many, except this and one with range-based for
loops.

Reply via email to