[LLVMbugs] [Bug 17771] New: Unexpected length_error on string::resize(max_size(), ..)
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Nov 1 10:57:23 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=17771
Bug ID: 17771
Summary: Unexpected length_error on string::resize(max_size(),
..)
Product: libc++
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: hhinnant at apple.com
Reporter: ruslan_baratov at yahoo.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
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
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131101/0b93db6c/attachment.html>
More information about the llvm-bugs
mailing list