32 lines · cpp
1// RUN: rm -fr %t2// RUN: mkdir %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 %t/foo.cppm -emit-module-interface -o %t/foo.pcm6// RUN: %clang_cc1 -std=c++20 %t/bar.cppm -emit-module-interface -fprebuilt-module-path=%t -o %t/bar.pcm7// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -verify %t/Use.cpp -fsyntax-only8//9//--- foo.cppm10export module foo;11export class foo {12};13 14//--- bar.cppm15export module bar;16import foo;17export auto bar() {18 return foo{};19}20 21//--- Use.cpp22// expected-no-diagnostics23import bar;24auto foo() {25 // [module.reach]Note1:26 // While module interface units are reachable even when they27 // are only transitively imported via a non-exported import declaration,28 // namespace-scope names from such module interface units are not found29 // by name lookup ([basic.lookup]).30 auto b = bar(); // foo should be reachable here.31}32