3 // RUN: split-file %s %t
6 // RUN: %clang_cc1 -std=c++20 M.cpp -emit-module-interface -o M.pcm
7 // RUN: %clang_cc1 -std=c++20 N.cpp -emit-module-interface -o N.pcm \
8 // RUN: -fmodule-file=M=M.pcm
9 // RUN: %clang_cc1 -std=c++20 Q.cpp -emit-module-interface -o Q.pcm
10 // RUN: %clang_cc1 -std=c++20 Q-impl.cpp -fsyntax-only -fmodule-file=Q=Q.pcm \
11 // RUN: -fmodule-file=N=N.pcm -fmodule-file=M=M.pcm -verify
20 export
void f(R::X
, R::X
);
30 export
template <typename T
, typename U
>
31 void apply(T t
, U u
) {
45 template <typename T
> operator T();
49 // OK, decltype(x) is R::X in module M
52 // error: R and R::f are not visible here
53 R::f(x
); // expected-error {{declaration of 'R' must be imported from module 'N' before it is required}}
54 // expected-note@N.cpp:4 {{declaration here is not visible}}
55 // expected-error@-2 {{no type named 'f' in namespace 'R'}}
57 f(x
); // Found by [basic.lookup.argdep] / p4.3
59 // error: S::f in module M not considered even though S is an associated
60 // namespace, since the entity Z is in a different module from f.
61 f(x
, S::Z()); // expected-error {{no matching function for call to 'f'}}
62 // expected-note@M.cpp:4 {{candidate function not viable: requires 1 argument, but 2 were provided}}
64 // error: S::f is visible in instantiation context, but R::g has internal
65 // linkage and cannot be used outside N.cpp
66 apply(x
, S::Z()); // expected-error@N.cpp:10 {{no matching function for call to 'g'}}
67 // expected-note@-1 {{in instantiation of function template specialization 'apply<R::X, S::Z>' requested here}}