llvm-project/clang/test/Modules/export-redecl-in-language-linkage.cppm
Chuanqi Xu e0d66c2424 [C++20] [Modules] Allow export redeclarations within language linkage
Close https://github.com/llvm/llvm-project/issues/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.
2024-07-12 13:55:56 +08:00

9 lines
169 B
C++

// RUN: %clang_cc1 -std=c++20 %s -verify -fsyntax-only
// expected-no-diagnostics
export module mod;
extern "C++" void func();
export extern "C++" {
void func();
}