title: Why is this rvalue call ambiguous?
body: <p>Why is this rvalue call ambiguous? I can have AA and AA&amp; and the compiler will know to use <code>AA&amp;</code>. But when i add in the third option i get an error. Obviously AA&amp;&amp; is a better overload then the others like int for an int is better then long. Why is this ambiguous? Is there a way i can keep all 3 overloads and make it clear which one i want? (Typecasting <code>(AA&amp;&amp;)</code> will not do it).</p>
  
  <pre><code>struct AA{
      void*this_;
      AA() { this_=this; }
      //not valid, use AA&amp;, AA(AA a){ this_=this; }
      AA(AA&amp;a){ this_=this; }
      AA(AA&amp;&amp;a){ this_=a.this_; }
  };
  void movetest(AA s) {}
  void movetest(AA&amp; s) {}
  //This gets me the ambiguous error void movetest(AA&amp;&amp; s) {}
  AA&amp;&amp; movetest() { return AA(); }
  void MyTestCode2(){
      AA a;
      AA b(a);
      AA c = movetest();
      movetest(AA());
  }
  </code></pre>