https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118386
Arthur Valiente <valiente.arthur at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|DUPLICATE |FIXED
--- Comment #4 from Arthur Valiente <valiente.arthur at gmail dot com> ---
(In reply to Andrew Pinski from comment #3)
> (In reply to Andrew Pinski from comment #2)
> > > Yet it works fine when compiling in -std=c++23
> >
> > C++23 changed the lifetime of the temporaries inside a range for.
>
> Before c++23, temporaries for initialization of the range (except for the
> outer most one) was destroyed right the finish of the expression but in
> c++23, they now live until the end of the for.
Sorry for the false positive then.
I found this through the range for loop and, when investigating, especially
when comparing with clang and switching cpp versions, I started to loose my
mind.
Thank you very much for the explanation.