title: Move constructors and inheritance
body: <p>I am trying to understand the way move constructors and assignment ops work in C++11 but I'm having problems with delegating to parent classes.</p>
  
  <p>The code:</p>
  
  <pre><code>class T0
  {
  public:
      T0() { puts("ctor 0"); }
      ~T0() { puts("dtor 0"); }
      T0(T0 const&amp;) { puts("copy 0"); }
      T0(T0&amp;&amp;) { puts("move 0"); }
      T0&amp; operator=(T0 const&amp;) { puts("assign 0"); return *this; }
      T0&amp; operator=(T0&amp;&amp;) { puts("move assign 0"); return *this; }
  };
  
  class T : public T0
  {
  public:
      T(): T0() { puts("ctor"); }
      ~T() { puts("dtor"); }
      T(T const&amp; o): T0(o) { puts("copy"); }
      T(T&amp;&amp; o): T0(o) { puts("move"); }
      T&amp; operator=(T const&amp; o) { puts("assign"); return static_cast&lt;T&amp;&gt;(T0::operator=(o)); }
      T&amp; operator=(T&amp;&amp; o) { puts("move assign"); return static_cast&lt;T&amp;&gt;(T0::operator=(o)); }
  };
  
  int main()
  {
      T t = std::move(T());
      return 0;
  }
  </code></pre>
  
  <p>However, when I compile and run under VS2012, the output indicates that the lvalue versions of the T0 members are called:</p>
  
  <pre><code>ctor 0
  ctor
  copy 0  &lt;--
  move    &lt;--
  dtor
  dtor 0
  dtor
  dtor 0
  </code></pre>
  
  <p>A similar situation (with a slightly different test case) happens with move assignments -- the move assignment operator of T calls the "normal" assignment operator of T0.</p>
  
  <p>What am I doing wrong?</p>