<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 --- - Clang can't read back a PCH just produced: Assertion failed: (D && "Cannot get layout of forward declarations!"), function getASTRecordLayout"
href="https://llvm.org/bugs/show_bug.cgi?id=31863">31863</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang can't read back a PCH just produced: Assertion failed: (D && "Cannot get layout of forward declarations!"), function getASTRecordLayout
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>4.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>Modules
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mehdi.amini@apple.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=17936" name="attach_17936" title="Repro reduced">attachment 17936</a> <a href="attachment.cgi?id=17936&action=edit" title="Repro reduced">[details]</a></span>
Repro reduced
Clang-4.0 (and trunk) are crashing when building Unreal Engine, a PCH can't be
read back we hit this assertion. I believe this is a regression from clang-3.9
introduced in r276159:
Author: Richard Smith <<a href="mailto:richard-llvm@metafoo.co.uk">richard-llvm@metafoo.co.uk</a>>
Date: Wed Jul 20 14:10:16 2016
[modules] Don't emit initializers for VarDecls within a module eagerly
whenever
we first touch any part of that module. Instead, defer them until the first
time that module is (transitively) imported. The initializer step for a
module
then recursively initializes modules that its own headers imported.
For example, this avoids running the <iostream> global initializer in
programs
that don't actually use iostreams, but do use other parts of the standard
library.
Reduced repro attached. Run with:
clang -c -x objective-c++-header pre.h -std=c++14 -o pre.gch
clang -c -x objective-c++ /dev/null -std=c++14 -include-pch pre.gch</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>