title: Why does the standard allow a tuple of rvalue references to be assigned to by a tuple of lvalue references?
body: <p>It seems like a <code>std::tuple</code> containing one or more references has unexpected behavior with regards to construction and assignment (especially copy/move construction and copy/move assignment). It's different from the behavior of both <code>std::reference_wrapper</code> (changes the referred to object) and a struct with a member reference variable (assignment operator deleted). It allows for the convenient <code>std::tie</code> python like multiple return values, but it also allows obviously incorrect code like the following <a href="http://coliru.stacked-crooked.com/a/5bb2f716d8db7af9" rel="nofollow noreferrer" title="code">(link here)</a>:</p>
  <pre><code>#include &lt;tuple&gt;
  
  int main()
  {
      std::tuple&lt;int&amp;&gt; x{std::forward_as_tuple(9)}; // OK - doesn't seem like it should be
      std::forward_as_tuple(5) = x; // OK - doesn't seem like it should be
      // std::get&lt;0&gt;(std::forward_as_tuple(5)) = std::get&lt;0&gt;(x); // ERROR - and should be
      return 0;
  }
  </code></pre>
  <p>The standard seems to require or strongly hint at this behavior in the copy(ish) assignment section <code>20.4.2.2.9</code> of the latest working draft (<code>Ti&amp;</code> will collapse to lvalue ref):</p>
  <blockquote>
  <p><code>template &lt;class... UTypes&gt; tuple&amp; operator=(const tuple&lt;UTypes...&gt;&amp; u);</code></p>
  <p>9 <strong>Requires:</strong> <code>sizeof...(Types) == sizeof...(UTypes)</code> and <strong><code>is_assignable&lt;Ti&amp;, const Ui&amp;&gt;::value</code></strong> is true for all <code>i</code>.</p>
  <p>10 <strong>Effects:</strong> Assigns each element of u to the corresponding element of *this.</p>
  <p>11 <strong>Returns:</strong> *this</p>
  </blockquote>
  <p>Although the move(ish) construction section <code>20.4.2.1.20</code> is less clear (<code>is_constructible&lt;int&amp;, int&amp;&amp;&gt;</code> returns <code>false</code>):</p>
  <blockquote>
  <p><code>template &lt;class... UTypes&gt; EXPLICIT constexpr tuple(tuple&lt;UTypes...&gt;&amp;&amp; u);</code></p>
  <p>18 <strong>Requires:</strong> <code>sizeof...(Types) == sizeof...(UTypes)</code>.</p>
  <p>19 <strong>Effects:</strong> For all <code>i</code>, the constructor initializes the <code>i</code>th element of <code>*this</code> with <code>std::forward&lt;Ui&gt;(get&lt;i&gt;(u))</code>.</p>
  <p>20 <strong>Remarks:</strong> This constructor shall not participate in overload resolution unless <strong><code>is_constructible&lt;Ti, Ui&amp;&amp;&gt;::value</code></strong> is true for all <code>i</code>. The constructor is <code>explicit</code> if and only if <code>is_convertible&lt;Ui&amp;&amp;, Ti&gt;::value</code> is false for at least one <code>i</code>.</p>
  </blockquote>
  <p>These are not the only affected subsections.</p>
  <p>The question is, why is this behavior desired? Also, if there are other parts of the standard at play, or I'm misunderstanding it, explain where I went wrong.</p>
  <p>Thanks!</p>