Martin Storsjo | 5be69bc | 2019-04-26 08:09:51 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm -triple i686-mingw32 %s -o - | FileCheck %s |
| 2 | |
Martin Storsjo | da93dec | 2019-04-26 19:31:39 +0000 | [diff] [blame] | 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 | |
Martin Storsjo | 5be69bc | 2019-04-26 08:09:51 +0000 | [diff] [blame] | 8 | template <class T> |
| 9 | class c { |
Martin Storsjo | 9534e9d | 2019-04-26 19:31:46 +0000 | [diff] [blame] | 10 | void f() {} |
Martin Storsjo | 5be69bc | 2019-04-26 08:09:51 +0000 | [diff] [blame] | 11 | }; |
| 12 | |
Martin Storsjo | 5be69bc | 2019-04-26 08:09:51 +0000 | [diff] [blame] | 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 | |
| 35 | template <class T> void outer<T>::f() {} |
| 36 | template <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 |
Martin Storsjo | da93dec | 2019-04-26 19:31:39 +0000 | [diff] [blame] | 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 |