<html>
<head>
<base href="https://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: 11 with >= in lambda in c++11" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24304&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=eZ9FfZCi8ojmb-vSyuQFYXgeInAiyUtWKjyF1330Xlk&s=hpL9zYygivzzrXxaizxbg5B8ZyaCUOVDzeZFTGyRpf4&e=">24304</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Segmentation fault: 11 with >= in lambda in c++11
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</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>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mars.lenjoy@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>I filed this because I assume this is not a deprecated version.
This is the current g++ in my OS X 10.9.5
$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
<code>
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
using namespace std;
int main() {
vector<pair<string, int>> vec2 = {
pair<string, int>("aaa", 3),
pair<string, int>("baaa", 4),
pair<string, int>("bbaaa", 5),
pair<string, int>("bbaac", 5),
pair<string, int>("bbbaaa", 6),
pair<string, int>("cccddd", 6),
pair<string, int>("ddd", 3)};
sort(vec2.begin(), vec2.end(),
[](const pair<string, int> &p1, const pair<string, int> &p2) {
cout << p1.second << " vs " << p2.second << endl;
// No problem with ">"
// if (p1.second > p2.second) { return true; }
// Segmentation fault: 11 with ">=",
// it's related to the data in vec2.
if (p1.second >= p2.second) { return true; }
return false;
});
for (const auto &p : vec2) {
cout << p.first << ", " << p.second << endl;
}
cout << endl;
}
</code>
$ g++ test.cpp -std=c++11
$ ./a.out</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>