<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62903>62903</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
c++20 nullptr_t should be in global namespace if <stddef.h> is included
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
gnbond
</td>
</tr>
</table>
<pre>
According to [CPPReference](https://en.cppreference.com/w/cpp/types/nullptr_t), for versions up to C++20 nullptr_t should be in the global namespace if <stddef.h> is included. I.e. the following code should compile:
```c++
#include <stddef.h>
void foo(nullptr_t) {}
```
According to Godbolt, this does compile for g++ from 10.1 onwards, but does not compile with clang 13-16.
For C++2x nullptr_t should be in global namespace.
It looks like stddef.h tries to implement this for the C++2x case, but there is a FIXME that is suspicious: https://github.com/llvm/llvm-project/blob/597dd1f91d9f3823e4184f1fe73d8125fa16c026/clang/lib/Headers/stddef.h#LL103C8-L103C8
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUk12PqzYQhn-NuRktMjYQuOBikxzalU6lVa96V_ljAHcdjGyz6f77yiHJfkjV0UoIy-B3Zt5nxiIEM86IHan2pDpmYo2T8904SzfrTDr91j0q5bw28wjRAan2h-fnP3FAj7NCUh0Ja6YYl0D4I2E9YT3OuVoWfzuSK3cirD8T1qtlIayPbwsGwvp5tXaJ_u9IWEvYAQbn4RV9MG4OsC4p24GwPWF7RuF-GMLkVqtBIpgZ4oQwWieFhVmcMCxCIZgBCD-EqDUO-UT4DzABzKzsqlHnAE855hfl4Kx15-RMOY23yMqdFmMx-aFHQh9JTbdHbdVcvzJ-Dfkl2fb71RkNg3OENR99Atntye74JTBs-0-gf3NaOhsTmDiZANphuJV2QTVu1cDg3QkKmhfg5rPwOiSJXOOmmF28q84mTqCsmEco-ENR59e827t3_s773__j_ZV1_jECPEWwzr0EsOYF4cYEojcYkidzWiyecI6bpeQiteE9qxIBb-XHCT2mzgnon_764wfEScS0D2tYjDJuTSMHn2dvNHFa5XXkrH29LQ-Ld_-gioT10jpJWF-1O62LoS10O_CGcSyLphyKAXdcNwWrBlHUirI6jW1ClgKZJPwdhUafBvjedMZ__iwoPzQP27LhyHTHdctbkWFX1E3ZUlrVTTZ1bEcrIaWiFVbY7LjkVGBZlQXjbSEqmZmOUcZpxUrKq5o2-U7JgaOsaVsXFHEgJcWTMDZP3nLnx8yEsGJXs5byzAqJNtxutO8uAOQ6BlJSa0IM77JoosVO_eqafe-KZau33bf7cnGQsF5M_BcAAP__L4lz5g">