https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112307
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |redi at gcc dot gnu.org --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- I don't quite see how return EnumeratorRange(Enumerator(std::views::single(Intersection()))); makes CompositeMesh::Intersections() return an object that refers to itself but points-to doesn't consider it could: callarg(12) = &mesh ... ESCAPED = &mesh intersections = NONLOCAL intersections = callarg(12) debugging at -O0 shows (gdb) p intersections $1 = {enumerator_ = { range_ = {<std::ranges::view_interface<std::ranges::single_view<Intersection> >> = {<No data fields>}, _M_value = {_M_value = {is_boundary_ = true}}}, begin_ = std::optional<Intersection *> = { [contained value] = 0x7fffffffde80}}, end_reached_ = false} (gdb) p &intersections $2 = (EnumeratorRange<CompositeMesh::Intersections() const::Enumerator> *) 0x7fffffffde80 so it contains a reference to itself. As said this feels like those other issues which are maybe invalid because of object lifetimes. But maybe there's sth special here.