[LLVMbugs] [Bug 22485] New: EXC_BAD_ACCESS crash using std::set::erase on Mac OS X
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Feb 5 16:11:44 PST 2015
http://llvm.org/bugs/show_bug.cgi?id=22485
Bug ID: 22485
Summary: EXC_BAD_ACCESS crash using std::set::erase on Mac OS X
Product: libc++
Version: unspecified
Hardware: PC
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: delyan.nestorov at gmail.com
CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
Classification: Unclassified
The code at the bottom compiled with Xcode or clang++ command line crashes in
template <class _NodePtr>
inline _LIBCPP_INLINE_VISIBILITY
bool
__tree_is_left_child(_NodePtr __x) _NOEXCEPT
{
return __x == __x->__parent_->__left_;
}
with EXC_BAD_ACCESS.
In contrast if I use the g++ compiler at
http://www.tutorialspoint.com/compile_cpp11_online.php it works just fine.
CODE:
#include <iostream>
#include <set>
struct blabla
{
public:
int _x, _y;
blabla() : _x(1), _y(2) {}
void print()
{
std::cout<<_x<<":"<<_y<<std::endl;
}
};
int main(int argc, const char * argv[]) {
// insert code here...
std::cout << "Hello, World!\n";
std::set<blabla *> blablaset;
for(int i=0; i<10; i++)
{
blablaset.insert(new blabla());
}
for(auto b : blablaset)
{
//b->print();
auto found = blablaset.find(b);
if(found != blablaset.end())
{
std::cout<<"found "<<b<<". deleting."<<std::endl;
blablaset.erase(found);
delete b;
}
}
return 0;
}
Kind regards,
Delyan
--
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/20150206/cf8d02e9/attachment.html>
More information about the llvm-bugs
mailing list