title: Why must a coroutine type be move constructible?
body: <p>[  This is specific to TS coroutines, VC++17 and later.  Not a duplicate. ]</p>
  
  <p>I am experimenting with experimental coroutines. I defined a coroutine type called "resumable_thing" (It's based on a talk by McNellis in 2016. At present, it has evolved into a primitive one-celled generator.) <strong>The type will not compile unless either a copy-constructor or a move-constructor is defined,</strong> despite the fact that the ctor can never be invoked? </p>
  
  <p><strong><em>Why is that?</em></strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;experimental/coroutine&gt;
  #include &lt;experimental/generator&gt;
  
  using namespace std;
  using namespace experimental;
  template&lt;class T&gt;
  struct resumable_thing {
      struct promise_type {
          T _value;
          resumable_thing get_return_object() {
              return resumable_thing(coroutine_handle&lt;promise_type&gt;::from_promise(*this));
          }
          auto initial_suspend() { return suspend_always{}; }
          auto final_suspend() { return suspend_always{}; }
          void return_value(const T&amp; value) {_value = value; }        
          void yield_value(const T&amp;v) { return_value(v); }
      };
  
      coroutine_handle&lt;promise_type&gt; _coroutine;
  
      // ???? Why must I define this? ????
      resumable_thing(resumable_thing &amp;&amp;other) {
          assert(false);
          _coroutine = std::move(other._coroutine);
          other._coroutine = nullptr;
      }
      // Member functions 
      void resume() { _coroutine.resume(); }
      auto get() {return _coroutine.promise()._value;}
      auto operator() () { resume(); return get(); }
  
      // Ctors dtors
      resumable_thing(resumable_thing const&amp;) = delete; 
      resumable_thing&amp; operator=(resumable_thing const&amp;) = delete;
      resumable_thing() = default;
  
      explicit resumable_thing(coroutine_handle&lt;promise_type&gt; coroutine)
          : _coroutine(coroutine)
      {}
  
      ~resumable_thing() { if (_coroutine) _coroutine.destroy(); }
  
  
  
  };
  
  static
  resumable_thing&lt;int&gt; take_five() {
      for (int i = 0; i&lt;5 ; ++i) {
          co_yield i;
      }
      co_return -1;
  }
  
  int main() {    
      auto count = take_five();
      for (int i = count(); i &gt;= 0; i=count()) {
          cout &lt;&lt; i &lt;&lt; '\n';
      }
      return 0;
  }
  </code></pre>
  
  <p>ADDED LATER.  I still do not know why VC++ complains. In any case, it is clear what the movers should do, if they do anything, to wit:</p>
  
  <pre><code>resumable_thing(resumable_thing &amp;&amp;right_) 
      : coroutine_(right_.coroutine_)
  {
      right_.coroutine_ = nullptr;
  }
  
  resumable_thing &amp;operator=(resumable_thing &amp;&amp;right_)
  {
      if (this != std::addressof(right_)) {
          coroutine_ = right_.coroutine_;
          right_.coroutine_= nullptr;
      }
      return *this;
  }
  </code></pre>