<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63887>63887</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Errors handling extern "C" variables in unnamed namespaces post-CWG 1113
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c++11,
clang:frontend,
miscompilation,
accepts-invalid,
rejects-valid
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hubert-reinterpretcast
</td>
</tr>
</table>
<pre>
Since C++11, the following code should compile:
```cpp
namespace {
extern "C" const int x = 42; // name has internal linkage; name has no language linkage ([dcl.link]/1)
}
namespace A { extern "C" const int x = 0; }
int main(void) { return A::x; }
```
Clang complains that `x` is redefined: https://godbolt.org/z/r4bdWfnrs
Online compiler link demonstrating miscompilation with use of inline variable definitions: https://godbolt.org/z/Psx79YEKK
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMk02PszYQxz_NcBklAhsIHDjk5aGH59BKPax6NPYE3Bob2Sab9tNXJpusdi-thED854Uf_xmLEPRoiTqoTlBdMrHGyfluWgfycedJ20h-8RSlCDEbnPq7-11bSXgGdgJ2KgpgZ4wT4dUZ4961HVE6RRgmtxqF0s2LNgT8CPkF8iPU-eOSy_JQrJgpLEISwuH0kJDukbxFYOwMjKF0NkTUNuIdgV-wZMBPCKwH1mOqx0kE3FCtMGi0_UuMlHJeQevQCDuuYqRnHIE1UJ2UNPukQHUB1hfA2g_Sw-U74DEh_hdcvrE9i5M-C22BNTenFbB26-Eprt7iMfnCj_cvJS-LPl63-znRb24aoW3AOImIUOd3qHPUAT0pumpLCvgRpxiXkFpvDo1ODc7EvfMjsP4fYL0vB_V2tT48ev9qjbb0HJXf_EFFc_oxL2Ia6azDIyyidhbfdZxwDYTuivpRfRNei8EQbhw6pYX_w_JbuB_aP378_PlgyVTHVctbkVFX1E1b1m1T1tnUldX1UFPNGyLOaiabpmYtL0QtSp6LfMh0x3LG80NR50WRl_VeVKo6tExdpeRskA2UOc1Cm70xtzkRZDqElbqaN80hM2IgE7ZjwJj8XG4G25hl8h_48eqdjWTVK_DVmZcspKQlhp22N2H0Z7qnP0nGsHup1SXzXSLaDesYoMyNDjF8MkYdDXU_vHc-4CSsMmke33bwaX46BLjatLEKX3sbcHEh7s5vv2BRFDxbvem-jUXHaR320s3A-vTpj8du8S7xAus3rwKwfrPr3wAAAP__4OVQSQ">