66 lines · plain
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/test-A.pcm6// RUN: %clang_cc1 -std=c++20 %t/N.cppm -emit-reduced-module-interface -o %t/test-N.pcm7// RUN: %clang_cc1 -std=c++20 %t/B.cppm -verify -fsyntax-only -fprebuilt-module-path=%t8 9//--- a.h10namespace N {11 12 template <typename>13 class C {14 template <typename> friend void foo();15 };16 17 template <typename> void foo() {}18} // namespace N19 20//--- a.cppm21// This is some unrelated file. It also #includes system headers, but22// here does not even export anything.23module;24#include "a.h"25export module test:A;26export {27 using N::C;28 using N::foo;29}30 31//--- std.h32// Declarations typically #included from C++ header files:33namespace N { // In practice, this would be namespace std34 inline namespace impl { // In practice, this would be namespace __135 template <typename>36 class C {37 template <typename> friend void foo();38 };39 40 template <typename> void foo() {}41 } // namespace impl42 } // namespace N43 44//--- N.cppm45module;46#include "std.h"47export module test:N;48 49// Now wrap these names into a module and export them:50export {51 namespace N {52 using N::C;53 using N::foo;54 }55}56 57//--- B.cppm58// expected-no-diagnostics59// A file that consumes the partitions from the other two files,60// including the exported N::C name.61module test:B;62import :N;63import :A;64 65N::C<int> x;66