mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-09 10:16:06 +00:00

Normally, in MinGW mode, inline methods aren't dllexported. However, in the case of a dllimported template instantiation, the inline methods aren't instantiated locally, but referenced from the instantiation. Therefore, those methods also need to be dllexported, in the case of an instantiation. GCC suffers from the same issue, reported at [1], but the issue is still unresolved there. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89088 Differential Revision: https://reviews.llvm.org/D61176 llvm-svn: 359343
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
// RUN: %clang_cc1 -emit-llvm -triple i686-mingw32 %s -o - | FileCheck %s
|
|
|
|
#define JOIN2(x, y) x##y
|
|
#define JOIN(x, y) JOIN2(x, y)
|
|
#define UNIQ(name) JOIN(name, __LINE__)
|
|
#define USEMEMFUNC(class, func) void (class::*UNIQ(use)())() { return &class::func; }
|
|
|
|
template <class T>
|
|
class c {
|
|
void f() {}
|
|
};
|
|
|
|
template class __declspec(dllexport) c<int>;
|
|
|
|
// CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIiE1fEv
|
|
|
|
extern template class __declspec(dllexport) c<char>;
|
|
template class c<char>;
|
|
|
|
// CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIcE1fEv
|
|
|
|
extern template class c<double>;
|
|
template class __declspec(dllexport) c<double>;
|
|
|
|
// CHECK-NOT: define {{.*}} dllexport {{.*}} @_ZN1cIdE1fEv
|
|
|
|
template <class T>
|
|
struct outer {
|
|
void f();
|
|
struct inner {
|
|
void f();
|
|
};
|
|
};
|
|
|
|
template <class T> void outer<T>::f() {}
|
|
template <class T> void outer<T>::inner::f() {}
|
|
|
|
template class __declspec(dllexport) outer<int>;
|
|
|
|
// CHECK: define {{.*}} dllexport {{.*}} @_ZN5outerIiE1fEv
|
|
// CHECK-NOT: define {{.*}} dllexport {{.*}} @_ZN5outerIiE5inner1fEv
|
|
|
|
extern template class __declspec(dllimport) outer<char>;
|
|
USEMEMFUNC(outer<char>, f)
|
|
USEMEMFUNC(outer<char>::inner, f)
|
|
|
|
// CHECK: declare dllimport {{.*}} @_ZN5outerIcE1fEv
|
|
// CHECK: define {{.*}} @_ZN5outerIcE5inner1fEv
|