<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Unexpected length_error on string::resize(max_size(), ..)"
   href="http://llvm.org/bugs/show_bug.cgi?id=17771">17771</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Unexpected length_error on string::resize(max_size(), ..)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>hhinnant@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ruslan_baratov@yahoo.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This code exit with status 1(length_error):

#include <string>
#include <stdexcept>

int main() {
  try {
    std::string s;
    s.resize(s.max_size(), 'x');
    return 0;
  }
  catch (std::length_error& exc) {
    return 1;
  }
  catch (std::bad_alloc& exc) {
    return 2;
  }
}

expected 0(OK) or 2(bad_alloc).

C++ Standard 2011, 21.4.4 basic_string capacity [string.capacity]:
void resize(size_type n, charT c);
7. Throws: length_error if n > max_size().

Changing '-libstd=libc++' to '-stdlib=libstdc++' help, return status is 2
(bad_alloc).

libcxx version(git): 76a8670ce4404429a36ea8672590da79172528c8</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>