On Wed, 25 Dec 2024, 01:15 Arsen Arsenović, <ar...@aarsen.me> wrote:
> libstdc++-v3/ChangeLog: > > PR libstdc++/118196 > * include/std/generator (generator::operator=(generator)): Add > missing 'return *this;'. > * > testsuite/24_iterators/range_generators/move-assign-missing-return.C: > New test. > Libstdc++ uses .cc extensions. OK with that change, thanks. --- > libstdc++-v3/include/std/generator | 1 + > .../range_generators/move-assign-missing-return.C | 13 +++++++++++++ > 2 files changed, 14 insertions(+) > create mode 100644 > libstdc++-v3/testsuite/24_iterators/range_generators/move-assign-missing-return.C > > diff --git a/libstdc++-v3/include/std/generator > b/libstdc++-v3/include/std/generator > index 3a19d535ef86..7d7e9b708657 100644 > --- a/libstdc++-v3/include/std/generator > +++ b/libstdc++-v3/include/std/generator > @@ -717,6 +717,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > { > swap(__other._M_coro, this->_M_coro); > swap(__other._M_began, this->_M_began); > + return *this; > } > > _Iterator > diff --git > a/libstdc++-v3/testsuite/24_iterators/range_generators/move-assign-missing-return.C > b/libstdc++-v3/testsuite/24_iterators/range_generators/move-assign-missing-return.C > new file mode 100644 > index 000000000000..ae161df2a4a6 > --- /dev/null > +++ > b/libstdc++-v3/testsuite/24_iterators/range_generators/move-assign-missing-return.C > @@ -0,0 +1,13 @@ > +// { dg-do compile { target c++23 } } > +#include "<generator>" > + > +std::generator<int> > +generator(); > + > +void > +try_reassigning() > +{ > + auto gen = generator(); > + auto gen2 = generator(); > + gen = std::move(gen2); > +} > -- > 2.47.1 > >