xref: /llvm-project/clang/test/Modules/implicit-module-with-missing-path.cpp (revision dc4e85bd79ff17014cbbe4a9db1d9b91929e91ce)
1 // This tests that the compiler wouldn't crash if the module path misses
2 
3 // RUN: rm -rf %t
4 // RUN: mkdir -p %t/subdir
5 // RUN: echo "export module C;" >> %t/subdir/C.cppm
6 // RUN: echo -e "export module B;\nimport C;" >> %t/B.cppm
7 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/subdir/C.cppm -o %t/subdir/C.pcm
8 // RUN: %clang_cc1 -std=c++20 -emit-module-interface -fprebuilt-module-path=%t/subdir %t/B.cppm -o %t/B.pcm
9 // RUN: %clang_cc1 -std=c++20 -fmodule-file=B=%t/B.pcm %s -fsyntax-only -verify
10 
11 import B; // expected-error {{failed to find module file for module 'C'}}
12 import C; // expected-error {{module 'C' not found}}
13