1 // RUN: %clang_cc1 -emit-llvm -triple i686-mingw32 %s -o - | FileCheck %s 2 3 #define JOIN2(x, y) x##y 4 #define JOIN(x, y) JOIN2(x, y) 5 #define UNIQ(name) JOIN(name, __LINE__) 6 #define USEMEMFUNC(class, func) void (class::*UNIQ(use)())() { return &class::func; } 7 8 template <class T> 9 class c { f()10 void f() {} 11 }; 12 13 template class __declspec(dllexport) c<int>; 14 15 // CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIiE1fEv 16 17 extern template class __declspec(dllexport) c<char>; 18 template class c<char>; 19 20 // CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIcE1fEv 21 22 extern template class c<double>; 23 template class __declspec(dllexport) c<double>; 24 25 // CHECK-NOT: define {{.*}} dllexport {{.*}} @_ZN1cIdE1fEv 26 27 template <class T> 28 struct outer { 29 void f(); 30 struct inner { 31 void f(); 32 }; 33 }; 34 f()35template <class T> void outer<T>::f() {} f()36template <class T> void outer<T>::inner::f() {} 37 38 template class __declspec(dllexport) outer<int>; 39 40 // CHECK: define {{.*}} dllexport {{.*}} @_ZN5outerIiE1fEv 41 // CHECK-NOT: define {{.*}} dllexport {{.*}} @_ZN5outerIiE5inner1fEv 42 43 extern template class __declspec(dllimport) outer<char>; 44 USEMEMFUNC(outer<char>, f) 45 USEMEMFUNC(outer<char>::inner, f) 46 47 // CHECK: declare dllimport {{.*}} @_ZN5outerIcE1fEv 48 // CHECK: define {{.*}} @_ZN5outerIcE5inner1fEv 49