Issue 64755
Summary [C++20] [Modules] We shouldn't allow the `import xxx;` to accept `xxx.pcm` which comes from explicit clang modules
Labels clang:modules
Assignees ChuanqiXu9
Reporter ChuanqiXu9
    Currently, possibly due to we reused a lot of logics from clang modules to implement C++20 modules, the c++20 modules style import can accept explicit clang modules surprisingly. But this is not what we want for sure. We should prevent this.

Reproducer:

```
// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a0 -x c++ -emit-module %t/module.modulemap -o %t/a0.pcm
// RUN: %clang_cc1 -std=c++20 %t/use.cpp -fmodule-file=%t/a0.pcm -verify -fsyntax-only
// RUN: %clang_cc1 -std=c++20 %t/use.cpp -fmodule-file=a0=%t/a0.pcm -verify -fsyntax-only
// RUN: %clang_cc1 -std=c++20 %t/use.cpp -fprebuilt-module-path=%t -verify -fsyntax-only

//--- module.modulemap
module a0 { header "a0.h" export * }

//--- a0.h
void a0() {}

//--- use.cpp
// expected-no-diagnostics
import a0;
void use() {
 a0();
}

```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to