<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 --- - EXC_BAD_ACCESS crash using std::set::erase on Mac OS X"
href="http://llvm.org/bugs/show_bug.cgi?id=22485">22485</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>EXC_BAD_ACCESS crash using std::set::erase on Mac OS X
</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>MacOS X
</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>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>delyan.nestorov@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu, mclow.lists@gmail.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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
<a href="http://www.tutorialspoint.com/compile_cpp11_online.php">http://www.tutorialspoint.com/compile_cpp11_online.php</a> 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</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>