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 -I%t -emit-module-interface -o %t/A.pcm 6// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -verify -fsyntax-only 7// 8// RUN: rm %t/A.pcm 9// RUN: %clang_cc1 -std=c++20 %t/A.cppm -I%t -emit-reduced-module-interface -o %t/A.pcm 10// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -verify -fsyntax-only 11// 12//--- foo.h 13 14namespace ns { 15 16struct T { 17 T(void*); 18}; 19 20struct A { 21 template <typename F> 22 A(F f) : t(&f) {} 23 24 T t; 25}; 26 27template <typename T> 28void foo(T) { 29 auto f = [](){}; 30 ns::A a(f); 31} 32} 33 34//--- A.cppm 35module; 36#include "foo.h" 37export module A; 38export namespace ns { 39 using ns::A; 40 using ns::foo; 41} 42 43//--- Use.cpp 44// expected-no-diagnostics 45import A; 46void test() { 47 ns::foo(5); 48} 49