-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C++ Modules] Exporting Redeclaration within language linkage #98583
Comments
@llvm/issue-subscribers-clang-modules Author: Chuanqi Xu (ChuanqiXu9)
This is discussed in WG21's mailing list. Although this is not formally merged into the standard, I think it is fine to work on it already.
Reproducer:
Clang now will reject it due to [[module.intefcae] p6](https://eel.is/c++draft/module.interface#6). But we think the rejection may not be necessary. Since the intention of [[module.intefcae] p6](https://eel.is/c++draft/module.interface#6) is to avoid the name conflicting. But the entities in language linkage are always attached to global module. So we don't need to worry about the name conflicting here. |
Close llvm#98583 Currently, clang will reject the following code: ``` export module mod; extern "C++" void func(); export extern "C++" { void func(); } ``` while both MSVC and GCC accept it. Although clang's behavior matches the current wording, from the discussion, the consensus is that we should accept the above example from the intention. Since the intention to not allow export redeclaration which is not exported is to make the linkage clear. But it doesn't matter with the declarations within global module.
Clang 19 allows to export redeclarations within language linkage. llvm/llvm-project#98583 Exporting implicitly declared `type_info`/`operator new`/`operator delete` is no longer illegal. llvm/llvm-project#90620 Clang 19.1.1 with VS 17.11 supports `import std`. - llvm/llvm-project#108732 - microsoft/STL#4626
This is discussed in WG21's mailing list. Although this is not formally merged into the standard, I think it is fine to work on it already.
Reproducer:
Clang now will reject it due to [module.intefcae] p6. But we think the rejection may not be necessary. Since the intention of [module.intefcae] p6 is to avoid the name conflicting. But the entities in language linkage are always attached to global module. So we don't need to worry about the name conflicting here.
And both MSVC and GCC accept it: https://godbolt.org/z/74sTe4nP6
The text was updated successfully, but these errors were encountered: