49 lines · plain
1// RUN: rm -rf %t2// RUN: split-file %s %t3// RUN: cd %t4 5// Related to issue #1320596 7// Precompile the module dependencies correctly 8// RUN: %clang_cc1 -std=c++20 -emit-module-interface a.cppm -o a.pcm9// RUN: %clang_cc1 -std=c++20 -emit-module-interface b.cppm -o b.pcm \10// RUN: -fmodule-file=A=a.pcm11 12// Verify that providing incorrect mappings via13// `-fmodule-file=<name>=<path/to/bmi>` does not crash the compiler when loading14// a module that imports the incorrectly mapped module.15// RUN: not %clang_cc1 -std=c++20 main1.cpp -fmodule-file=A=b.pcm16 17//--- a.cppm18export module A;19 20export int a() {21 return 41;22}23 24//--- b.cppm25export module B;26import A;27 28export int b() {29 return a() + 1;30}31 32//--- main1.cpp33import A;34 35int main() {36 return a();37}38 39// Test again for the case where the BMI is first loaded correctly40// RUN: not %clang_cc1 -std=c++20 main2.cpp-fmodule-file=B=b.pcm \41// RUN: -fmodule-file=A=b.pcm42 43//--- main2.cpp44import B;45 46int main() {47 return b();48}49