llvm-capstone/clang/test/Modules/inconsistent-export.cppm
Chuanqi Xu 2e9977c281 [C++20] [Modules] Treat module linkage as formal linkage only
Close https://github.com/llvm/llvm-project/issues/61321

There are two linkage modes in clang now: one for internal linkage and
one for formal linkage. The internal linkage is for the implementation
details and the formal linkage is for the consistency with the C++
standard.

Since we previously implemented the strong ownership for modules, the
module linkage is not meaningful for linkers any more. So the module
linkage should only be used for formal linkage.
2023-03-13 15:54:40 +08:00

47 lines
851 B
C++

// RUN: rm -fr %t
// RUN: mkdir %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/m-a.pcm
// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -o %t/m-b.pcm \
// RUN: -fprebuilt-module-path=%t
// RUN: %clang_cc1 -std=c++20 %t/m.cppm -emit-module-interface -o %t/m.pcm \
// RUN: -fprebuilt-module-path=%t
// RUN: %clang_cc1 -std=c++20 %t/use.cppm -fprebuilt-module-path=%t -emit-obj
//--- a.cppm
export module m:a;
namespace n {
export class a {
public:
virtual ~a() {}
};
}
//--- b.cppm
export module m:b;
namespace n {
class a;
}
//--- m.cppm
export module m;
export import :a;
export import :b;
//--- use.cppm
// expected-no-diagnostics
export module u;
export import m;
struct aa : public n::a {
aa() {}
};
auto foo(n::a*) {
return;
}
void use() {
n::a _;
}