You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In file included from c.cpp:1:a.cpp:3:15: error: declaration 'x' attached to named module 'a' can't be attached to other modules 3 | constexpr int x = 0; | ^b.cpp:3:15: note: also found 3 | constexpr int x = 0; | ^1 error generated.
I believe this code should be accepted and have the same behavior as if x were declared static in both module a and module b. x has module linkage in both module a and module b. Because of that, and based on https://eel.is/c++draft/basic.link#8, the two declarations of x are not declaring the same entity and thus the error is incorrect.
The text was updated successfully, but these errors were encountered:
In file included from c.cpp:1:a.cpp:3:15: error: declaration 'x' attached to named module 'a' can't be attached to other modules 3 | constexpr int x = 0; | ^b.cpp:3:15: note: also found 3 | constexpr int x = 0; | ^1 error generated.
I believe this code should be accepted and have the same behavior as if x were declared static in both module a and module b. x has module linkage in both module a and module b. Because of that, and based on https://eel.is/c++draft/basic.link#8, the two declarations of x are not declaring the same entity and thus the error is incorrect.
Given the following three translation units:
And compiling with
causes clang to fail with
I believe this code should be accepted and have the same behavior as if
x
were declaredstatic
in bothmodule a
andmodule b
.x
has module linkage in bothmodule a
andmodule b
. Because of that, and based on https://eel.is/c++draft/basic.link#8, the two declarations ofx
are not declaring the same entity and thus the error is incorrect.The text was updated successfully, but these errors were encountered: