55 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 {11inline namespace impl {12 template <typename>13 class C {14 template <typename> friend void foo();15 };16 17 template <typename> void foo() {}18} // namespace impl19} // namespace N20 21//--- a.cppm22// This is some unrelated file. It also #includes system headers, but23// here does not even export anything.24module;25#include "a.h"26export module test:A;27// To make sure they won't elided.28using N::C;29using N::foo;30 31//--- N.cppm32module;33#include "a.h"34export module test:N;35 36// Now wrap these names into a module and export them:37export {38 namespace N {39 inline namespace impl {40 using N::impl::C;41 using N::impl::foo;42 }43 }44}45 46//--- B.cppm47// expected-no-diagnostics48// A file that consumes the partitions from the other two files,49// including the exported N::C name.50module test:B;51import :N;52import :A;53 54N::C<int> x;55