<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:dibeas@ieee.org" title="David Rodríguez <dibeas@ieee.org>"> <span class="fn">David Rodríguez</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED --- - Assign rvalue to self"
   href="http://llvm.org/bugs/show_bug.cgi?id=16993">bug 16993</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>CLOSED
           </td>
           <td>REOPENED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>dibeas@ieee.org
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>INVALID
           </td>
           <td>---
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED --- - Assign rvalue to self"
   href="http://llvm.org/bugs/show_bug.cgi?id=16993#c5">Comment # 5</a>
              on <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED --- - Assign rvalue to self"
   href="http://llvm.org/bugs/show_bug.cgi?id=16993">bug 16993</a>
              from <span class="vcard"><a class="email" href="mailto:dibeas@ieee.org" title="David Rodríguez <dibeas@ieee.org>"> <span class="fn">David Rodríguez</span></a>
</span></b>
        <pre>I don't agree with Howard's interpretation.

a = std::move(a);

After evaluation of just the right hand side, only a cast is done. The state of
the object is still guaranteed to be the initial state. If after just
'std::move' the container 'a' was deemed to be in a valid but unspecified state
this would not be a bug, but I don't think that is the case.

Now we are left with the assignment:

a = static_cast<vector<int>&&>(a);

The requirements for that operation are stated in Table 99, in the entry:

a = rv

The "Assertion/note/pre-post-condition" column has as a post condition:

post: a shall be equal to the value that rv had before this assignment.

>From the point of view of 'a' used as the lhs of the expression, the
precondition that "size() > 100" must hold, since that precondition held on the
rhs of the assignment before the operation.

The conflict here is that there are two set of post conditions, one for the
lhs, one for the rhs:

lhs : must hold the value that rhs held before the assignment
rhs : must be in an indeterminate but valid state

If lhs is rhs, those two requirements are met by guaranteeing that, on self
assignment from an rvalue-reference to itself, the container is left
unmodified.

[All the above is ignoring the allocator completely, but I don't think that
matters as that would be an orthogonal issue]</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>