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