| 1 |
// RUN: %clang_cc1 -fmodules -std=c++17 -verify %s |
| 2 |
// RUN: %clang_cc1 -fmodules -std=c++17 -verify %s -DLOCAL |
| 3 |
// expected-no-diagnostics |
| 4 |
|
| 5 |
#pragma clang module build A |
| 6 |
module A {} |
| 7 |
#pragma clang module contents |
| 8 |
#pragma clang module begin A |
| 9 |
inline auto f() { struct X {}; return X(); } |
| 10 |
inline auto a = f(); |
| 11 |
auto g(int); |
| 12 |
template<typename T> auto h(T t) { return g(t); } |
| 13 |
#pragma clang module end |
| 14 |
#pragma clang module endbuild |
| 15 |
|
| 16 |
#pragma clang module build B |
| 17 |
module B {} |
| 18 |
#pragma clang module contents |
| 19 |
#pragma clang module begin B |
| 20 |
inline auto f() { struct X {}; return X(); } |
| 21 |
inline auto b = f(); |
| 22 |
auto g(int) { return 0; } |
| 23 |
#pragma clang module end |
| 24 |
#pragma clang module endbuild |
| 25 |
|
| 26 |
#ifdef LOCAL |
| 27 |
inline auto f() { struct X {}; return X(); } |
| 28 |
inline auto b = f(); |
| 29 |
auto g(int) { return 0; } |
| 30 |
#else |
| 31 |
#pragma clang module import B |
| 32 |
#endif |
| 33 |
|
| 34 |
#pragma clang module import A |
| 35 |
|
| 36 |
using T = decltype(a); |
| 37 |
using T = decltype(b); |
| 38 |
|
| 39 |
int test_g = h(0); |