| 1 |
// RUN: rm -fr %t |
| 2 |
// RUN: mkdir %t |
| 3 |
// RUN: split-file %s %t |
| 4 |
// |
| 5 |
// RUN: %clang_cc1 -std=c++20 %t/foo.cppm -emit-module-interface -o %t/foo.pcm |
| 6 |
// RUN: %clang_cc1 -std=c++20 %t/bar.cppm -emit-module-interface -fprebuilt-module-path=%t -o %t/bar.pcm |
| 7 |
// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -verify %t/Use.cpp -fsyntax-only |
| 8 |
// |
| 9 |
//--- foo.cppm |
| 10 |
export module foo; |
| 11 |
export class foo { |
| 12 |
}; |
| 13 |
|
| 14 |
//--- bar.cppm |
| 15 |
export module bar; |
| 16 |
import foo; |
| 17 |
export auto bar() { |
| 18 |
return foo{}; |
| 19 |
} |
| 20 |
|
| 21 |
//--- Use.cpp |
| 22 |
// expected-no-diagnostics |
| 23 |
import bar; |
| 24 |
auto foo() { |
| 25 |
// [module.reach]Note1: |
| 26 |
// While module interface units are reachable even when they |
| 27 |
// are only transitively imported via a non-exported import declaration, |
| 28 |
// namespace-scope names from such module interface units are not found |
| 29 |
// by name lookup ([basic.lookup]). |
| 30 |
auto b = bar(); // foo should be reachable here. |
| 31 |
} |