brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 81ddfd6 Raw
52 lines · cpp
1// RUN: %clang_cc1 -std=c++11 -fmodules %s -verify2 3#pragma clang module build M4  module M { module A {} module B {} module C {} }5#pragma clang module contents6  7  #pragma clang module begin M.A8    template<typename U> struct X {9      template<typename T> void f();10    };11  #pragma clang module end12  13  #pragma clang module begin M.B14    template<typename T, typename U = void> struct ST { static void f(); };15  #pragma clang module end16  17  #pragma clang module begin M.C18    template<typename U> struct X;19    void foo(X<int>);20  #pragma clang module end21#pragma clang module endbuild22 23#pragma clang module build N24  module N {}25#pragma clang module contents26  #pragma clang module begin N27    #pragma clang module import M.B // not re-exported28 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.B37      foo(*this); // found by ADL in M.C38    };39 40    #pragma clang module import M.C // not re-exported41  #pragma clang module end42#pragma clang module endbuild43 44#pragma clang module import N45void 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}52