1// RUN: rm -rf %t 2// RUN: split-file %s %t 3// RUN: cd %t 4// 5// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm 6// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fmodule-file=a=%t/a.pcm -emit-module-interface -o %t/b.pcm 7// RUN: %clang_cc1 -std=c++20 %t/c.cppm -fmodule-file=a=%t/a.pcm -fmodule-file=b=%t/b.pcm -fsyntax-only -verify 8 9// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm 10// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fmodule-file=a=%t/a.pcm -emit-reduced-module-interface -o %t/b.pcm -DREDUCED 11// RUN: %clang_cc1 -std=c++20 %t/c.cppm -fmodule-file=a=%t/a.pcm -fmodule-file=b=%t/b.pcm -fsyntax-only -verify 12 13//--- a.cppm 14export module a; 15 16export template<typename T> 17void a(T x) { 18 +x; 19} 20 21//--- b.h 22struct s { 23}; 24void operator+(s) { 25} 26 27//--- b.cppm 28module; 29#include "b.h" 30export module b; 31import a; 32 33export template<typename T> 34void b() { 35 a(s()); 36} 37 38#ifdef REDUCED 39// Mention it to avoid the compiler optimizing it out. 40using ::operator+; 41#endif 42 43//--- c.cppm 44// expected-no-diagnostics 45export module c; 46import b; 47 48void c() { 49 b<int>(); 50} 51