<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63210>63210</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[C++20] [Modules] Incorrect linkage of non-exported variables introduced by lambda-expression
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:modules
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ChuanqiXu9
</td>
</tr>
</table>
<pre>
Reproducer:
```
export module A;
static void f () {}
auto lam = []{ f{};};
```
>From https://eel.is/c++draft/basic.link#3, the linkage of `lam` should be `module linkage`. But currently in clang, the linkage of `lam` is `internal linkage`.
I can image the reason should be the way we implement `module linkage`. Currently we implement `module linkage` by degrading `extern linkage` with conditions. But we never thought to promote original `internal linkage`. And for some other reason, the linkage of `lam` is internal instead of external in clang.
CC: @iains
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEU8GO4ygQ_ZrypdQWhjbdOfgQJxtpDnvZ014xVGx2MWQBdyZ_v8LOzHqknWkpqojy4-m9op5KyY6eqIO2h_ZcqSVPIXanaVH-H_vncqiGYB7dH3SLwSyaIogjsDOwb1Wy52890tdbiBnnYBZHeATR78Epq2w1fgRr8IrA34EfEN56eDvvYWrJAZ2aEcQZN13w1uP1iRTf6v8J2OolhhmnnG-pyOUX4BciV9sE_KKB98B7E9U1A78MKlldO-v_Bi4E_HaB_gTvJ8wTYemqkTBcESRzagbJME1hcQYHKr2n0ScQJKuxXzLqJUby2T3QetRO-RH4LyhtKgfrM0Wv3J5tb-oLauXRzuV6oYqkUvA7PaV5Vw-8E9r55mgmn38i8vRd4KdgHB5oaIzKWD8WBH0tOveIu80T6uCNzTb4tM3gTujpgyLmKSzjlDEHvMUwh0wYoh1tsfoT23j0Bq8hYgozYcgTxafdz-b4nc36lEmZAtgEr73tMWrcz_V0AnFEeGVWWZ9--FSZTpiDOKiKuka-S8GappXV1MlGCTIkSRvBRPvWKCW0bOjKJJfiVVS244wLJtmBvbeHpq0HQYMejFYtY9IcJLwympV1tXMfcx3iWNmUFuqk4A2rnBrIpTWUnG8LJI7b0yTgvCQ1duXmy7CMCV6Zsymn_7iyzW7N9Gnbds6gXbP0-5OjPeMXr0OMpPN-mD74ly3EZPBDRasGR-tYt_ybsg5OzYNRBRcpJRt8tUTX_Zi30eZpGWodZuCXouv593KL4S_SJXqr4RLJ1fO_AQAA__-0A21N">