xref: /llvm-project/clang/test/CXX/module/module.reach/p2.cpp (revision 0e7b30fa821dd4899227aa643030f4e4164f4e56)
1 // RUN: rm -rf %t
2 // RUN: mkdir -p %t
3 // RUN: split-file %s %t
4 // RUN: %clang_cc1 -std=c++20 %t/impl.cppm -emit-module-interface -o %t/M-impl.pcm
5 // RUN: %clang_cc1 -std=c++20 %t/M.cppm -emit-module-interface -fprebuilt-module-path=%t -o %t/M.pcm
6 // RUN: %clang_cc1 -std=c++20 %t/UseStrict.cpp -fprebuilt-module-path=%t -verify -fsyntax-only
7 
8 //--- impl.cppm
9 module M:impl;
10 class A {};
11 
12 //--- M.cppm
13 export module M;
14 import :impl;
15 export A f();
16 
17 //--- UseStrict.cpp
18 import M;
test()19 void test() {
20   auto a = f(); // expected-error {{definition of 'A' must be imported from module 'M' before it is required}} expected-error{{}}
21                 // expected-note@* {{definition here is not reachable}} expected-note@* {{}}
22 }
23