<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/90259>90259</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            C++ modules not handling internal linkage
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          rnikander
      </td>
    </tr>
</table>

<pre>
    In the following example code, I have two variables `int abc` that should be private to the files (internal linkage). They are in anonymous namespaces. But, they conflict with each other.

`main.cc`:
```
import mymod;
int main() {
 foo();
}
```
`mymod.cppm`:
```
module;
#include <stdio.h>
export module mymod;
export import :part1;
namespace { int abc; }
export void foo() {
    printf("In foo() %d\n", abc);
}
```
`part1.cppm`:
```
export module mymod:part1;
namespace { int abc; }
export void part1_fun() {}
```

Compiler error:

```
mymod.cppm:9:29: error: reference to 'abc' is ambiguous
    9 |     printf("In foo() %d\n", abc);
      |                             ^
/.../part1.cppm:4:17: note: candidate found by name lookup is '(anonymous namespace)::abc'
    4 | namespace { int abc; }
      |                 ^
mymod.cppm:6:17: note: candidate found by name lookup is '(anonymous namespace)::abc'
    6 | namespace { int abc; }
      |                 ^
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VV9vozgQ_zTDy2iRYwcIDzyQdCP1_d5PBg_BV2Mj27Sbb38yYZPeqr09aU9bVaB4PD9-fzyyDEFfLFEDxRGKp0wucXS-8Va_SKvIZ51T1-bZYhwJB2eMe9P2gvRNTrMh7J0i4Cd8xlG-EsY3h6_Sa9kZCggl0zai7HooGcZRRgyjW4zCjnD2-lVGwuhu0Hrt4AdtI3krDRptX-SFgNc5_jHSFaUn1BaldfY6uSWglROFWfYUcjwuMfGIaWPv7GB0H_FNxxFJ9iO6OJLPgT0Ba7dnySapbd4nciAeq9v_-lNPs_MRp-vkFIjjtmgjplbgB-A1QrWt4-Dcbe2-FaqnD3HTxxNm3s_z9C_fn5xaDD3guNC2N4siBHEKUWmXjyC-3qr07UZ27fmB81bb9IBoZ-nj7l6-O5nU4PfQxBHvAjaAV6fVQ-c77YgpURuHtcKf7ftdvFBQnCxwnjJK0P_No5Xkzzz6UPYv6Vt7_xyW9wl_RnJ9ntw0a0MeyXvnH0Q_jPSRu2hrEG2yor13oqeBPNl-nQzg1epWhTqgnDp9WdwSHpYnbif8BfPX3jvIZ39QfP1-AM95ngM_v0tGtHsQ7a5K5K2LlN69tEqrNN6DW6zC7roOKxrnXpY5iQFeAT98MMsruxZEexP-oLlfaf48yc8l3WX8I4Pyt7Av_z_29wOVqUaoWtQyo2ZX7fa7cscEy8amOnQFZ52ivqyGbl_x-sCqojqwoVCHXS0y3XDG92zPy11dMMFyXtWqp4KJfXnodqqCPaNJapMb8zrlzl8yHcJCTc14UWdGdmTCemVwbukN12I6YcVT5pvU86VbLgH2zOgQwwMl6mioOQE_Aj9uMxuS8ThKq0y6Wn68ALLFm2aMcQ7JWX4Gfr7oOC5d3rsJ-Dlhb68vs3d_UR-Bn1dGAfh5Zfx3AAAA__8Oa_g5">