<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 --- - libclang code completion crash (libclang 3.5 & 3.6)"
href="http://llvm.org/bugs/show_bug.cgi?id=22811">22811</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>libclang code completion crash (libclang 3.5 & 3.6)
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>3.5
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>dinosaurdynasty@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>Created <span class=""><a href="attachment.cgi?id=13989" name="attach_13989" title="Crashes libclang">attachment 13989</a> <a href="attachment.cgi?id=13989&action=edit" title="Crashes libclang">[details]</a></span>
Crashes libclang
The following program causes libclang to print "libclang: crash detected in
code completion" and return null for the last call:
```
const char program[] =
"void f(bool b);\n"
"void f(bool b) __attribute__((enable_if(b, "")));\n"
"int main() {\n"
" bool var = true;\n"
" f(var);\n" /* code complete inside f() */
"}\n";
#include <clang-c/Index.h>
#include <assert.h>
int main(int argc, char **argv)
{
CXUnsavedFile file = {"test.cpp", program, sizeof program};
CXIndex idx = clang_createIndex(1, 0);
assert(idx);
char* args[] = {};
CXTranslationUnit u = clang_parseTranslationUnit(idx, "test.cpp", args,
sizeof args, &file, 1, CXTranslationUnit_PrecompiledPreamble);
assert(u);
clang_reparseTranslationUnit(u, 0, 0, 0);
CXCodeCompleteResults* res = clang_codeCompleteAt(u, "test.cpp", 5, 6, 0,
0, 0);
assert(res);
}
```
This happens with both libclang 3.5 (1:3.5-4ubuntu2 (Ubuntu 14.10 Utopic)) and
libclang 3.6 (1:3.6~+rc2-2ubuntu1~xedgers14.10.1 (Ubuntu 14.10 Utopic,
<a href="https://launchpad.net/~xorg-edgers/+archive/ubuntu/ppa">https://launchpad.net/~xorg-edgers/+archive/ubuntu/ppa</a>)). I assume it happens
with other versions as well. It notably does not crash for 3.4
(1:3.4.2-10ubuntu1 on Utopic).</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>