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