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