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

    <tr>
        <th>Summary</th>
        <td>
            False Positive of ODR Violation for Functions with Internal Linkage in Modules
        </td>
    </tr>

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

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

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

<pre>
    Code ([CE](https://godbolt.org/z/7rqfqKvjq)):

* `m.cpp`:

  ```cpp
 module;
  #include <cstdio>
  export module m;
  static void f() { std::puts(__FILE__); }
  export auto &fr = f;
  ```
* `main.cpp`:
   
 ```cpp
  #include <cstdio>
  import m;
  static void f() { std::puts(__FILE__); }
  constexpr auto &fr1 = f;
  auto &fr2 = fr;
  int main() {
    fr1();
    fr2();
  }
  ```

Clang raises the following error:

```cpp
m.cpp:4:13: error: 'f' has different definitions in different modules; definition in module 'm' first difference is function body
    4 | static void f() { std::puts(__FILE__); }
      | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:3:13: note: but in '' found a different body
    3 | static void f() { std::puts(__FILE__); }
 | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

GCC accepts the code (as expected), and running the produced executable outputs:

```
/app/main.cpp
/app/m.cpp
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVMuO4zYQ_JrWpbGGREqWfdBBtkfBIhskyCHXAcWHzV2a1JCUZ5LDfntAyc8JEiDYIQgL6Oomq9rFZiHovZWygWoD1S5jYzw43_BvryxEz7LeiT-brRMSgayg2myfoNoBWR1iHALQFkgHpNs70TsTF87vgXR_Aelq_6Jefj59fQGyTpu2kE-btAjL_LjgwwDL_BrHFJ13QvIWj06MRgLdzCih2nIzJiJ0y0MU2gF9mjD5NjgfzwV4vJSEyKLmeHJaoErsyRqh3mCIIl1L22GMAcjq-bn7_OXp-XmiuUGod_ensjE6BLJUHoHuUF0JXejeiWLaPuhCxPT7Xtl_itHHWcwHqeDOhijfBn8npHhUcgPIDPgLom3EJOp27SwKlS_m2CUzhchj6MLgoVF5uzXM7tEzHWTAeJConDHuVds9Su-dvznlsWuzY2hbAm0LCrS9piOQWgGp8cACCq2U9NJGFFJpq6N2NqC2d8Dsk5C6dMtJKWcDAamP6TilfYjXOi5RB1Sj5VN6ehdn5SVCvf3R_ymtdMz3uwXV0_d_X6knF8PRll7bYl2U6duPMYkCUk9i3GgFsrs23CmgH6Dgf5N_54uftltknMshzrbg55nDQnqJkkcpplGyRWYF-tHaZJmUOXgnRi4FyjfJx8h6I9GNcWL7DzNNr7VjwwCku7bvPnYJXAoy0VCxpmuWyaaoy6quaUWK7NAUpagLtVairymtV8s6r0jPKyJpX5SUF5luSE6qvCR1kbBiUUpWkV7Vsl-VhVgqKHN5ZNosjDkd0-zMdAijbApaV5RmhvXShGkwE2LlK04oEJLmtG9S0ad-3Acoc6NDDLdjoo5GNh0zQeJvLuioTxKdwl93v-Mf2hk2WVg5j93ZzwFfdTzgZxult8zgF22_sb1MBvplfi7Z6E3zburreBj7BXdHIF26_Pz5NHj3VfIIpJsoByDdWdOpIX8HAAD__xI28F0">