<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60775>60775</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Modules] `#include <initializer_list>` is needed in importer
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
davidstone
</td>
</tr>
</table>
<pre>
Given the following two valid translation units:
```cpp
module;
#include <initializer_list>
export module a;
export template<typename>
void a() {
for (int x : {0}) {
}
}
```
```cpp
export module b;
import a;
void b() {
a<int>();
}
```
When compiled with
```shell
clang++ -std=c++20 -x c++-module --precompile -c a.cpp -o a.pcm
clang++ -std=c++20 -fmodule-file=a=a.pcm -c b.cpp -o /dev/null
```
clang fails with
```
In file included from b.cpp:1:
a.cpp:9:15: error: cannot deduce type of initializer list because std::initializer_list was not found; include <initializer_list>
for (int x : {0}) {
^
b.cpp:4:2: note: in instantiation of function template specialization 'a<int>' requested here
a<int>();
^
1 error generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVMGS4yYQ_ZrWpUsuCSzLOuhgr-NUDjnnmELQskghUAB5ZvP1KSR5dtaZ3czU2Iamef0ePFqEoG-WqIXqDNUlE3McnG-VuGsVorOUdU59bX_Vd7IYB8LeGeNetL1hfHF4F0YrjF7YYETUzuJsdQzAT1BcoHh8H4r1X07TGhmdmg0BP3-Xxri20syKEPgXbXXUwuh_yP9pdIjAf3mfTK-T8xFXIBRPUNtqpHEyIhLwL_HrRFaM9AZzd1qhAHYE1iDUb9ub3nkEdtQ24isCP6XFAurLc14KreO3wUPnz8V_T717oq7HZfVZ0UK3-4CuWM5qOZ5l8du-n9L6YyCL0o2TNqTwRcfhQ9JhIGPWmDTC3oCdgZ0xD1EBv8h1ygrMX3Gb5JuuPJ88bQUwlyh2cpowdyh2kxw_A9mvSHmvk1UuIn3S3oTWPdCAXRXdgV3t_CD6od6lFPZCm_Bjtev0N4upJG5mVNh7N64VgZ_KN3OLLdKkaJWcQt47nwZSWOsiKlKzJEzeQ9fjO0tjsjR2JMUcCBfpJ-CnZ9PjiwiYkHo3WwX8jJ95IfgpC-NHf1BtGA-5e-AnliCsS-_ohNqitiEKG_X64l2P_WzlMn48OAwTyYXbmgOsfu_TGj39PVOIpHAgTxuhH1r5P-zK9ajxRpa8iKR2TzeZqZarhjcio7Y81If9sSwOTTa0ouJlcSiaI-uqA2fHvuz6ho5lpwqxl0eZ6ZYVjBesrMq6LItmV3ZNKfpedJztS9HsYV_QKLTZGXMfd87fMh3CTO2hqOsqM6IjEx7t1LcpKe_mW4B9kS4pfNsWdTRL4_198XmA6oKJ_f-2wUOBOqAlSuZM97G0DPLZ7E07xDgtDZhdgV1vOg5zt5NuBHZNlbeffPLuL5IR2HVhH4BdFwH_BgAA__8l8cLg">