| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: split-file %s %t |
| 3 |
// RUN: cd %t |
| 4 |
// |
| 5 |
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/b.cppm -o %t/b.pcm |
| 6 |
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/a.cppm -fmodule-file=b=%t/b.pcm \ |
| 7 |
// RUN: -o %t/a.pcm |
| 8 |
// RUN: %clang_cc1 -std=c++20 %t/user.cpp -fmodule-file=a=%t/a.pcm -verify -fsyntax-only |
| 9 |
|
| 10 |
//--- b.cppm |
| 11 |
export module b; |
| 12 |
export int b() { |
| 13 |
return 43; |
| 14 |
} |
| 15 |
|
| 16 |
//--- a.cppm |
| 17 |
export module a; |
| 18 |
import b; |
| 19 |
export int a() { |
| 20 |
return b() + 43; |
| 21 |
} |
| 22 |
|
| 23 |
//--- user.cpp |
| 24 |
import a; // expected-error {{failed to find module file for module 'b'}} |
| 25 |
int use() { |
| 26 |
return a(); // expected-error {{use of undeclared identifier 'a'}} |
| 27 |
} |