<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 --- - Cannot get layout of forward declaration!"
href="https://llvm.org/bugs/show_bug.cgi?id=22894">22894</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Cannot get layout of forward declaration!
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>libclang
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>haxmeadroom@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>klimek@google.com, 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=14041" name="attach_14041" title="Example c file that causes the crash">attachment 14041</a> <a href="attachment.cgi?id=14041&action=edit" title="Example c file that causes the crash">[details]</a></span>
Example c file that causes the crash
Parsing the AST using a RecursiveASTVisitor and attempting to get the type size
causes an assert. Followed the guide at
<a href="http://clang.llvm.org/docs/LibASTMatchersTutorial.html">http://clang.llvm.org/docs/LibASTMatchersTutorial.html</a> , and created a simple
ASTVisitor that eventually calls-
context->getTypeSize( node->getType() ) ;
..which causes this trap
Assertion failed: (D && "Cannot get layout of forward declarations!"), function
getASTRecordLayout, file
/Users/clang-llvm/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp, line 2875.
Abort trap: 6
Attached is the example file that causes the crash.
Setup info
----------
uname: Darwin 14.1.0 Darwin Kernel Version 14.1.0: Thu Feb 26 19:26:47 PST
2015; root:xnu-2782.10.73~1/RELEASE_X86_64 x86_64
git: 99436fd8cdc553eca1997f27ef00db71b897e29c</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>