title: Return value optimization of tuple/tie
body: <p>I am looking into return value optimization in the case of tuple/ties and the behavior I observe is not as I expected. In the example below I would expect move semantics to kick in, which it does, but there is one copy operation which remains. The output from the below in optimized is:</p>
  
  <pre><code>Test duo output, non_reference tuple
  Default constructor invoked
  Parameter constructor invoked
  Copy constructor invoked
  Move Assignment operator invoked
  100
  </code></pre>
  
  <p>The invocation of the copy constructor in making the tuple inside the function seems unnecessary. Is there any way to remove this? I am using the MSVC 2012 compiler.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;tuple&gt;
  
  class A
  {
  public:
       int value;
       A() : value(-1)
       {
           std::cout &lt;&lt; "Default constructor invoked" &lt;&lt; std::endl;
       }
  
       explicit A(const int v) : value(v)
       {
           std::cout &lt;&lt; "Parameter constructor invoked" &lt;&lt; std::endl;
       }
  
       A(const A&amp; rhs)
       {
           value = rhs.value;
           std::cout &lt;&lt; "Copy constructor invoked" &lt;&lt; std::endl;
       }
  
       A(const A&amp;&amp; rhs)
       {
           value = rhs.value;
           std::cout &lt;&lt; "Move constructor invoked" &lt;&lt; std::endl;
       }
  
       A&amp; operator=(const A&amp; rhs)
       {
           value = rhs.value;
           std::cout &lt;&lt; "Assignment operator invoked" &lt;&lt; std::endl;
           return *this;
       }
  
       A&amp; operator=(const A&amp;&amp; rhs)
       {
           value = rhs.value;
           std::cout &lt;&lt; "Move Assignment operator invoked" &lt;&lt; std::endl;
           return *this;
       }
   };
  
   std::tuple&lt;A, int&gt; return_two_non_reference_tuple()
   {
       A tmp(100);
  
       return std::make_tuple(tmp, 99);
   }
  
   int main(int argc, char* argv[])
   {
  
        std::cout &lt;&lt; "Test duo output, non_reference tuple" &lt;&lt; std::endl;    
        A t3;
        int v1;
        std::tie(t3, v1) = return_two_non_reference_tuple();
        std::cout &lt;&lt; t3.value &lt;&lt; std::endl &lt;&lt; std::endl;
  
        system("pause");
        return 0;
  }
  </code></pre>