<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 --- - Segmentation fault while constructing std::function from "bind" object"
href="http://llvm.org/bugs/show_bug.cgi?id=17468">17468</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Segmentation fault while constructing std::function from "bind" object
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>andrey.goryachev@gmail.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 program crashes with segmentation fault on line "std::function<void()>
c3(c2);":
#include <functional>
void
func(int) {
// pass
}
int
main() {
std::function<void(int)> c1(&func);
auto c2 = std::bind(c1, 5);
std::function<void()> c3(c2);
return 0;
}
I compile it with command "clang++ -std=c++0x -stdlib=libc++ -o test main.cpp"
and then just run "./test".
I have following software:
1) Mac OS X 10.8.5,
2) Command Line Tools 5.0.0.0.1.1377666378,
3) clang:
Apple LLVM version 5.0 (clang-500.2.75) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
Also i tried to run it under gdb and got following infinite recursion:
...
#6348 0x00000001000043e3 in
_ZNSt3__18functionIFviEEC2INS_6__bindIRS2_JiEEEEET_PNS_9enable_ifIXsr10__callableIS7_EE5valueEvE4typeE
()
#6349 0x0000000100003a5d in
_ZNSt3__18functionIFviEEC1INS_6__bindIRS2_JiEEEEET_PNS_9enable_ifIXsr10__callableIS7_EE5valueEvE4typeE
()
#6350 0x00000001000043e3 in
_ZNSt3__18functionIFviEEC2INS_6__bindIRS2_JiEEEEET_PNS_9enable_ifIXsr10__callableIS7_EE5valueEvE4typeE
()
#6351 0x0000000100003a5d in
_ZNSt3__18functionIFviEEC1INS_6__bindIRS2_JiEEEEET_PNS_9enable_ifIXsr10__callableIS7_EE5valueEvE4typeE
()
#6352 0x0000000100001ea4 in
_ZNSt3__18functionIFvvEEC2INS_6__bindIRNS0_IFviEEEJiEEEEET_PNS_9enable_ifIXsr10__callableIS9_EE5valueEvE4typeE
()
#6353 0x000000010000145d in
_ZNSt3__18functionIFvvEEC1INS_6__bindIRNS0_IFviEEEJiEEEEET_PNS_9enable_ifIXsr10__callableIS9_EE5valueEvE4typeE
()
#6354 0x000000010000131d in main ()</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>