https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104872
--- Comment #1 from Benjamin Buch <benni.buch at gmail dot com> --- More minimal version: https://godbolt.org/z/aEv13e38a ```cpp #include <coroutine> #include <iostream> #include <string_view> using namespace std::literals; class logging_string{ public: logging_string(std::string_view text) :text_(text) { std::cout << " view: " << this << " " << text_ << std::endl; } logging_string(logging_string&& other) { std::cout << " move: " << this << " <= " << &other << " new <= " << other.text_ << std::endl; text_ = std::move(other.text_); } ~logging_string(){ std::cout << " destruct: " << this << " " << text_ << std::endl; } logging_string& operator=(logging_string&& other){ std::cout << "move-assign: " << this << " <= " << &other << " " << text_ << " <= " << other.text_ << std::endl; text_ = std::move(other.text_); return *this; } private: std::string text_; }; struct wrapper{ // wrapper() = default; // wrapper(std::string_view text) :filename(text) {} // wrapper(wrapper&&) = default; // wrapper& operator=(wrapper&&) = default; // ~wrapper() = default; logging_string filename; }; struct generator{ struct promise_type; using handle_type = std::coroutine_handle<promise_type>; struct promise_type{ wrapper value{"default"sv}; generator get_return_object(){ return handle_type::from_promise(*this); } std::suspend_always initial_suspend(){ return {}; } std::suspend_always final_suspend()noexcept{ return {}; } void unhandled_exception(){} std::suspend_always yield_value(wrapper&& new_value){ value = std::move(new_value); return {}; } }; generator(handle_type h) : handle(h) {} ~generator(){ handle.destroy(); } handle_type handle; }; static generator generate(){ co_yield {"generate"sv}; } int main(){ auto gen = generate(); gen.handle(); } ```