Issue 186603
Summary [modules] Duplicate definitions of `inline` functions in different TUs of the same named module are incorrectly not diagnosed, even when reachable from each other
Labels new issue
Assignees
Reporter HolyBlackCat
    ```cpp
export module A;
import :P;
export inline void x() {}
```
```cpp
export module A:P;
export inline void x() {}
```
```cpp
import A;

int main()
{
    x();
}
```
This is ill-formed per https://eel.is/c++draft/basic.def.odr#16.3 .

> 16. For any other definable item D with definitions in multiple translation units,
> 
> (16.1) — ..., or
> (16.2) — if the definitions in different translation units do not satisfy the following requirements,
> 
> the program is ill-formed; a diagnostic is required only if the definable item is attached to a named module and a prior definition is reachable at the point where a later definition occurs.
> ... the following requirements shall be satisfied.
> 
> (16.3) — Each such definition shall not be attached to a named module ...

Clang accepts this, but it shouldn't (same for MSVC). GCC correctly rejects this.

Tested on Clang 22.1.0 commit 4434dabb69916856b824f68a64b029c67175e532.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to