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//--- foo.h
9
10namespace ns {
11
12struct T {
13    T(void*);
14};
15
16struct A {
17    template <typename F>
18    A(F f) : t(&f)  {}
19
20    T t;
21};
22
23template <typename T>
24void foo(T) {
25    auto f = [](){};
26    ns::A a(f);
27}
28}
29
30//--- A.cppm
31module;
32#include "foo.h"
33export module A;
34export namespace ns {
35    using ns::A;
36    using ns::foo;
37}
38
39//--- Use.cpp
40// expected-no-diagnostics
41import A;
42void test() {
43    ns::foo(5);
44}
45