<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/71347>71347</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[C++20][Modules] Cannot export a declaration within a linkage-specification
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:modules
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
cpplearner
</td>
</tr>
</table>
<pre>
Clang rejects the following module unit:
```c++
export module mod;
extern "C++" {
export void f();
}
```
(https://godbolt.org/z/dPYhGW7ah)
The error message is:
```
<source>:4:5: error: export declaration can only be used within a module purview
4 | export void f();
| ^
```
I think the declaration of `f` should be considered to be within the *purview* of module `mod`, even though it is *attached to* the global module.
Note that GCC and MSVC accept the above module unit.
Also note that clang seems to permit `export extern "C++" { void f(); }`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVNGOozYU_ZrLy9VExgQIDzxkyGbVh60qtWrVR2NfwF3HRrbJ7PbrKxOykxlpupKVgLnn-NzjY4sQ9GiJWiifoTxlYomT862cZ0PCW_JZ79T3tjPCjujpH5IxYJwIB2eMe9F2xItTiyFcrI5QHIGdgN1_K3YbEvhzGussfZudj3fYxSkonh9R9C2StwicdxuMc4R6q0FE3BiuTiscgB-AN68c9end4m8U8cMU4xySUH4Gfh6d6p2JO-dH4Od_gZ_Vb39Pn_-qxZRYH6B_TITkvfN4oRDESKjDR_1ur0UX3OIlQfEJiuMeimMJxfHGsj7c-lAkjfAiamdRCovOmu_YEy6BFL7oOGmL4u7XvPirppdXM_YIdYc_s2UtWCuh_PQ_Bv2Cabmv6xY_6nIDQsUGqBiGyS1GJYHS2aAVeVIYXZrYxCYw8ONdKj8m-KYfKpa2vGLAO6QrpWq3jBPqiDokmIhRyGnlTNBENhrXC7NR7B71_uoiYZxExM9dh8Iq_PL7nx0KKWmOK1b07kqPIX2DP5rg0P4gkWvOA9ElpJZm8hcdk-bN24-y-d50TDGs2C5TbaGaohEZtXnVNLxomrrJplapJq_rWuzLfUWHoa-Y4gfWFIeq6mUzlJluOeNFnrOKFazKmx0b5DDsRX7IZVnyXMGe0UVoszPmekn5zXQIC7V1XuzrzIieTFhPNedrV1AcbyYE4Dwddd8m5FO_jAH2zOgQwytX1NGsl8LWJ2dQnqB8_rJRlCfshLUu3lMn3sTlR2qNtl_FSE9hJqkHLdfP2eJN--4c6jgt_U66C_BzUrH9Pc3epUsH-HltLwA_rx3-FwAA___z1mx7">