[llvm-bugs] [Bug 47140] New: length_error exception not being thrown
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Aug 12 09:18:52 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47140
Bug ID: 47140
Summary: length_error exception not being thrown
Product: clang
Version: 10.0
Hardware: Macintosh
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: teammember0x01 at gmail.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
This program should cause a length_error immediately but it doesn't. This
behavior is followed by GCC 10 and MetroWerks C++ compilers.
#include <iostream>
#include <string>
using namespace std;
int main(int argc, const char * argv[])
{
string buffer("hi");
try {
std::string mystring(buffer.max_size()+1, 'X');
}
catch(length_error &l) {
cout<<"Caught length_error exception: "<<l.what()<<endl;
}
catch(exception &e) {
cout<<"Caught exception: "<<e.what()<<endl;
}
return 0;
}
What actually happens is the program crashes with EXC_BAD_ACCESS on Mac OS
10.8. Clang 5.1 and Clang 10.0.0.1 have this issue.
--
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/20200812/d20c26ce/attachment.html>
More information about the llvm-bugs
mailing list