<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/76526>76526</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang accepts _export-declaration_ after _linkage-specification_
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
JohelEGP
</td>
</tr>
</table>
<pre>
A _linkage-specification_ is a _name-declaration_
and has a terminal `extern` _unevaluated-string_ _name-declaration_.
An _export-declaration_ isn't a _name-declaration_,
but Clang accepts one after a _linkage-specification_.
GCC diagnoses it: <https://compiler-explorer.com/z/nozWPbxbG>.
But Clang accepts it with an unexpected result: <https://compiler-explorer.com/z/eefn3sWMs>.
Note that if the `export` comes before the `extern`, both accept.
GCC: <https://compiler-explorer.com/z/Y3zn6EEKK>.
Clang: <https://compiler-explorer.com/z/zb5qhxYEa>.
```C++
module;
#include <iostream>
export module module_utility;
extern "C" __attribute__ ((visibility ("default")))
export void utility() {
std::cout << "Hello from utility!" << std::endl;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVM1u4zYQfhrqMrAhDf2ngw6OYqfoosXeFnsSKGlksaVIlxyl3jx9QUmNmzR7CECIEMnvh9-QVCHoiyUqxPZBbB8TNXLvfPGr68mcnr4mtWt_FEeojLZ_qgutwpUa3elGsXa2Ah1AQWXVQKuWGqP8PC7SR5EelW2hV3EFkx-0VQbELqUbk7dil0I1WnpWZlRM7Sqw1_ZSfUC2ntmOFiq6XZ3nN7OggxW45499YDmD65GhNMpeQDUNXTmAswSqY_IR-PHuFuH5-1SW0Gp1sS5QAM1CHkHIsme-BiGPAs8Cz40brtqQX9Htapwnv27cIPD8IvBs3cu3r_WtfhLytDA__M-VZvhbcw_KwmjpdqWGqQVPYTSfVyTqrAzffgt3xfn7u2MC7hWD7oB7mssSo41ladxAAWrqnKf77FI0gSXULjqcHK9fw_m0u-_yxe5Opy9f7u6mLD5N9FJv_-pv30_q_Taj3amVAh9im0YH146GhFx-BUptGzO2FFW1C-xJDUKe5uk5FphBS1eNrI3mH68cczogEEuBCFWlmL2uR6aqAoEHgYdnHXQ9oeYBbKlTsaiIAvOl_Vfx2ekW_hWKiBzEftEDCNzGbOSxcSNH40KWUf8XMsZB591wx2bR07LkFUe2NfcM9o_vEkvaQra5zFVCRbZP5T5P080m6YstdVIduhy7ts4OeZZR21Ca75ttp7K97BJdYIoyQzxkEYNrarq6zbKd6lDW3SYXm5QGpc3amOdh7fwl0SGMVOx3W9wlRtVkwvQaITbTeUCMD5Mv4vpVPV6C2KRGBw53BtZsqHh7lT58LOYb_5P7nozeFG_P3UVzP9bLYYtyS7e6evcHNSzwPLkPAs_TBv4JAAD__9hQr7k">