<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61931>61931</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Error combining c++20, libc++, PCH and stdarg
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Chronial
</td>
</tr>
</table>
<pre>
The following fails with clang-15 and clang-16 on ubuntu 18 (binaries from https://github.com/llvm/llvm-project/releases)
`pch.h`
```
#include <stdlib.h>
```
`pch.cpp`
```
#include "pch.h"
```
`test.cpp`
```
#include "pch.h"
#include <stdarg.h>
```
## Run
```
clang++ -stdlib=libc++ -std=c++20 -Xclang -emit-pch -o pch.pch -c pch.cpp
clang++ -stdlib=libc++ -std=c++20 -Xclang -include-pch -Xclang pch.pch -c test.cpp
```
## Error
```
In file included from test.cpp:2:
/opt/clang-16/lib/clang/16/include/stdarg.h:14:9: error: reference to '__builtin_va_list' is ambiguous
typedef __builtin_va_list __gnuc_va_list;
^
note: candidate found by name lookup is '__builtin_va_list'
note: candidate found by name lookup is '__builtin_va_list'
```
Building without PCHs (i.e. `clang++ -stdlib=libc++ -std=c++20 -c test.cpp`) works fine.
## Godbolt
This is also reproducible on godbolt: https://godbolt.org/z/xTen4ae65
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVMuu2zYQ_RpqM7AgkbJsLbTwI2q6C4q76M4gxZHEhiYFPnJ7-_WFHvY1Ujdt0xiGbY6HZ87MHB3uveoNYk22R7I9JzyGwbr6NDhrFNeJsPKtfhkQOqu1fVWmh44r7eFVhQFazU2_ybfAjbwdSrAGoogmRMj3QOheKMOdQg-ds1cYQhg9YQdCG0KbXoUhirS1V0Ibrb_cvjajs79hGwhtHGrkHj2hFcnOJDusn2U2tkM6kDK7B9b3cqRMmVZHiUDYyQeplUgHwj48z37EbMfx36BSuhCg9NuQAX34bsyvu-Cu_8cuKCOUwS_RPE2a90TokdAjbJa5EHbWSrQPQcLO65FmsPl1vgMbvKqwGdsBNhYmnvPPFm4z-7_wa6dLhTX4UOY-x2-0_jiAD85Z9zT5ZwOd0ghrQbko847PDnQS6IrV2HGS4U3ek0CVuAUIbebQikRo876jQ14QdqgIOwDOVNgBHHbo0LQIwQKhu8tFRKWDMpcv_KKVD4TuQHngV6H6aKNfWIS3ESV28Jd0uFx6E9v7bXZcLsD6IttVKcYGnAi03EgleZie6GgkiDcw_Iqgrf0cx6n037D6oTBPl3eMSsvJYSZvsTHAp9PHCWevUkyBlNl3SOtBNWVGaAWv1n320CmD6RPJ_GSlsDossZdB-XkX2ltwODorY6uExsnh-jWTHb52tOWP1LpJHH8Q2vz-gqbgWG4TWTNZsYonWOflPivzYlvukqGWW1p0JRa0xbLMS5oLVu3LrtsXJcNqLxJV04yyrMiKnFFa7NIqE9WukkKUxU5KiaTI8MqVTifznGonyvuIdZlXLE80F6j9zeNdPTusiL0nRTbtxb9fCyporOdHB1p7FcpMG7lPlNATvA98On06fZztf9F9Ep2u_7PFz1w9oc1M988AAAD__4lq8ic">