<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:mclow.lists@gmail.com" title="Marshall Clow (home) &lt;mclow.lists&#64;gmail.com&gt;"> <span class="fn">Marshall Clow (home)</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed" title="RESOLVED INVALID - vector of const - push_back fail" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23852&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=RYxfXIWvQmEd7j-WorLvuKB8TS5tCTvULT-fR9SuTYc&s=r0yd9iK-NMK8IztNE7o--9gVXYapzMp8I0eZYL-AhYM&e=">bug 23852</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>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>INVALID
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Assignee</td>
           <td>unassignedclangbugs@nondot.org
           </td>
           <td>mclow.lists@gmail.com
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed" title="RESOLVED INVALID - vector of const - push_back fail" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23852-23c1&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=RYxfXIWvQmEd7j-WorLvuKB8TS5tCTvULT-fR9SuTYc&s=WG2ieTdAs9NYQ8cIG1dZFr72-_efDBrl-RYDY2RZIKc&e=">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed" title="RESOLVED INVALID - vector of const - push_back fail" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23852&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=RYxfXIWvQmEd7j-WorLvuKB8TS5tCTvULT-fR9SuTYc&s=r0yd9iK-NMK8IztNE7o--9gVXYapzMp8I0eZYL-AhYM&e=">bug 23852</a>
              from <span class="vcard"><a class="email" href="mailto:mclow.lists@gmail.com" title="Marshall Clow (home) &lt;mclow.lists&#64;gmail.com&gt;"> <span class="fn">Marshall Clow (home)</span></a>
</span></b>
        <pre>The standard says the requirement for push_back is that the value type (T) of a
vector needs to be "T shall be CopyInsertable into X." (where X is the
container) [Table 100]

What does that mean? [23.2.1/15] says:

Given a container type X having an allocator_type identical to A and a
value_type identical to T and given an lvalue m of type A, a pointer p of type
T*, an expression v of type (possibly const) T ...

(skip ahead to p15.4)

T is CopyInsertable into X means that, in addition to T being MoveInsertable
into X, the following expression is well-formed:
     allocator_traits<A>::construct(m, p, v)

and its evaluation causes the following postcondition to hold: The value of v
is unchanged and is equivalent to *p.

So, it needs to be able to this:
    std::allocator<const int> a;
    const int *p;
    int v = 17;
    std::allocator_traits<std::allocator<const int>>::construct(m, p, v);

but p is a pointer to const int - and so the allocator cannot construct a new
int there.

Hence, the compile failure.


In general, containers of const types is a bad idea.</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>