title: Why is this move constructor not working
body: <p>I have the following code snippet. Does anyone know why this move constructor is not called for all cases in the main function? Why does it compile anyway? Assignment operator is private? Here the link: <a href="http://ideone.com/bZPnyY" rel="nofollow">http://ideone.com/bZPnyY</a></p>
  
  <pre><code>#include &lt;iostream&gt;    
  #include &lt;vector&gt;
  
  class A{
  public:
      A(int i){
          std::cout &lt;&lt; "Constructor "&lt;&lt; i &lt;&lt;std::endl;
          for(int l = 0; l&lt;i;l++){
              vec.push_back(l);
          }
      };
  
      A(A &amp;&amp; ref): vec(std::move(ref.vec))
      {
         std::cout &lt;&lt; "Move constructor"&lt;&lt;std::endl;
      }
  
      A &amp; operator=(A &amp;&amp; ref){
         if(this != &amp;ref){
              vec = std::move(ref.vec);
         }
         std::cout &lt;&lt; "Move assignment"&lt;&lt;std::endl;
         return *this;
  
      }
  
      std::vector&lt;int&gt; vec;
  
  private:
      A(const A &amp; ref);
      A(A &amp; ref);
      A &amp; operator=(A &amp; ref);
  };
  
  
  A makeA(){
      A a(3);
      return a;
  }
  
  int main(){
      A b1(makeA()) ;
      A b2 = makeA();
      A b3 = A(3);
      A b4(A(3));
      std::cout &lt;&lt; b4.vec[2] &lt;&lt; std::endl;
  };
  </code></pre>
  
  <p><strong>Output:</strong><br>
  Constructor 3<br>
  Constructor 3<br>
  Constructor 3<br>
  Constructor 3<br>
  2  </p>
  
  <p>Some Additions to the responses:
  When I add</p>
  
  <pre><code> std::pair&lt;int,A&gt; a(3,A(3));
  </code></pre>
  
  <p>Then the move constructor gets called (so no NRVO hopefully)</p>