title: Can I mark a moved variable as no longer usable and receive a compiler warning if I do use it?
body: <p>Sometimes in a function I use <code>std::move</code> to pass on a variable I'm no longer using, like this:</p>
  
  <pre><code>void f(std::vector&lt;int&gt; v)
  {
      for (int i: v)
      {
          std::cout &lt;&lt; i &lt;&lt; ", ";
      }
  }
  
  void main()
  {
      std::vector&lt;int&gt; v(1000);
      std::fill(v.begin(), v.end(), 42);
      f(std::move(v));
  }
  </code></pre>
  
  <p>I understand the std::move leaves my vector in a valid state, so I could call <code>v.clear()</code> and reuse it if I wanted to do so. But in a long function I may later add more code to it and forget that I've lost the data with my move function, introducing a bug.</p>
  
  <p>Is there some kind of compiler instruction I can put after the move to warn me not to reuse this variable? Like this:</p>
  
  <pre><code>void main()
  {
      std::vector&lt;int&gt; v(1000);
      std::fill(v.begin(), v.end(), 42);
      f(std::move(v));
      #pragma mark_unusable(v);
  
      // This should trigger a compiler warning
      v.clear();
  }
  </code></pre>