| 1 |
// RUN: %clang_cc1 -std=c++11 -fmodules %s -verify |
| 2 |
|
| 3 |
#pragma clang module build M |
| 4 |
module M { module A {} module B {} module C {} } |
| 5 |
#pragma clang module contents |
| 6 |
|
| 7 |
#pragma clang module begin M.A |
| 8 |
template<typename U> struct X { |
| 9 |
template<typename T> void f(); |
| 10 |
}; |
| 11 |
#pragma clang module end |
| 12 |
|
| 13 |
#pragma clang module begin M.B |
| 14 |
template<typename T, typename U = void> struct ST { static void f(); }; |
| 15 |
#pragma clang module end |
| 16 |
|
| 17 |
#pragma clang module begin M.C |
| 18 |
template<typename U> struct X; |
| 19 |
void foo(X<int>); |
| 20 |
#pragma clang module end |
| 21 |
#pragma clang module endbuild |
| 22 |
|
| 23 |
#pragma clang module build N |
| 24 |
module N {} |
| 25 |
#pragma clang module contents |
| 26 |
#pragma clang module begin N |
| 27 |
#pragma clang module import M.B // not re-exported |
| 28 |
|
| 29 |
template<typename U> struct X { |
| 30 |
template<typename T> void f(); |
| 31 |
template<typename T> void g(); |
| 32 |
}; |
| 33 |
|
| 34 |
template<typename U> template<typename T> |
| 35 |
void X<U>::f() { |
| 36 |
ST<T>::f(); // definition and default argument found in M.B |
| 37 |
foo(*this); // found by ADL in M.C |
| 38 |
}; |
| 39 |
|
| 40 |
#pragma clang module import M.C // not re-exported |
| 41 |
#pragma clang module end |
| 42 |
#pragma clang module endbuild |
| 43 |
|
| 44 |
#pragma clang module import N |
| 45 |
void g() { |
| 46 |
X<int>().f<int>(); |
| 47 |
|
| 48 |
ST<int>::f(); // expected-error {{must be imported from module 'M.B'}} |
| 49 |
foo(X<int>()); // expected-error {{must be imported from module 'M.C'}} |
| 50 |
// expected-note@* 2{{declaration here is not visible}} |
| 51 |
} |