Skip to content

Commit 9a1cb52

Browse files
committed
libstdc++: add missing return in generator assignment operator [PR118196]
libstdc++-v3/ChangeLog: PR libstdc++/118196 * include/std/generator (generator::operator=(generator)): Add missing 'return *this;'. * testsuite/24_iterators/range_generators/pr118196.cc: New test.
1 parent 5a41ab8 commit 9a1cb52

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

libstdc++-v3/include/std/generator

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
717717
{
718718
swap(__other._M_coro, this->_M_coro);
719719
swap(__other._M_began, this->_M_began);
720+
return *this;
720721
}
721722

722723
_Iterator
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// { dg-do compile { target c++23 } }
2+
#include "<generator>"
3+
4+
std::generator<int>
5+
generator();
6+
7+
void
8+
try_reassigning()
9+
{
10+
auto gen = generator();
11+
auto gen2 = generator();
12+
gen = std::move(gen2);
13+
}

0 commit comments

Comments
 (0)