<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/57417>57417</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[C++20] [Modules] Crashed if we import a module whose GMF contains removed header
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:modules,
crash-on-invalid
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ChuanqiXu9
</td>
</tr>
</table>
<pre>
We can reproduce it by:
```C++
// foo.h
#include <iostream>
void Hello() {
std::cout << "Hello World.\n";
}
// foo.cppm
module;
#include "foo.h"
export module foo;
export using ::Hello;
// Use.cpp
import foo;
int main() {
Hello();
}
```
And compile it by:
```
clang++ -std=c++20 foo.cppm --precompile -o foo.pcm
mv foo.h foo.orig.h
# The following one is rejected
clang++ -std=c++20 Use.cpp -fmodule-file=foo.pcm -c
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNU8GOmzAQ_RpzsYgcEyAcOGSTbnvZW6vt1dgGXBmbYpPt_n3HBnazq0itZBnNjGfmvTdDY8Vr_SwxZwZPcpysmLnEyuPmFWUnRC6IbHdBlnNG9CGc6MUY0Uc4uLV217_7MmW4noXEKDsr6_wk2YCyL9uDq1UCf5NaW0SPiFYYlW8FMXZehObZidvZhwpwoCaNCfjZTlrsUH424ELZO5Dycov3AzI-jsPmHoCjlreJN2gpXYhA5TUq_4x28mtWKHaTucZmp0yHF8gLqe3JJyg_nAxQNq8aYvrHmspAM6bMPWFuFLtLfBvRbfOTEZjbYVT6H3NdTK6Z6ZYJ4zQO4sIXk5I3KXGajpPcquLUxsjIV42H67IO8baT6rbNAKXx9z6oCDxegmjWACoHq_dLci_Ff2BYNcRpu4wkbVWY5mVFgFN-l1ci631R7MucHo9FIupMVFnFEq-8ljXKH85bA5RfMNhPsbgL1nlirpcCqxa_yG1obNuIl946ib8-PYLKxsPgApvBXiGhl0zIKZknXffejy4oHxehU76fmx0ICIbW1-0DqtogBJjKuRna08e8POzLpK8pPxZZxlpellUr2yoXpMlkUzKyBy5NkWjWSO0CF9jeRcLsNKw0YJ9p_Id4IJNakypzZVqJEMkviaopoZQcaUUKsqeHXVtykh_JQTBeVVTm6EAkrKXeBZww1C6Z6gi5mTsHQa2cd-9B5pzqjIzShvps9r2d6nM_M_Nb_ZyrJBKsI7u_fbhMOA">