https://bugs.llvm.org/show_bug.cgi?id=40256
Bug ID: 40256
Summary: Dllexport on template instantiations has no effect in
MinGW mode
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: mar...@martin.st
CC: blitzrak...@gmail.com, compn...@compnerd.org,
david.majne...@gmail.com, dgre...@apple.com,
erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
richard-l...@metafoo.co.uk, r...@google.com,
smee...@fb.com
The following code snippet instantiates a template and dllexports the generated
symbols, when built in MSVC mode:
template<class T> class MyClass {
public:
MyClass(int a);
private:
T val;
};
template<class T> MyClass<T>::MyClass(int a) {
val = a;
}
extern template class MyClass<int>;
template class __declspec(dllexport) MyClass<int>;
When built in MinGW mode, it doesn't produce any export directives, but it
doesn't when built with GCC either, and GCC warns:
dllexport.cpp:15:38: warning: type attributes ignored after type is already
defined [-Wattributes]
template class __declspec(dllexport) MyClass<int>;
GCC does, however, produce export directives if the dllexport attribute is on
the template instantiation declaration:
extern template class __declspec(dllexport) MyClass<int>;
template class MyClass<int>;
The same also works when specified on the original template declaration. Clang
in MinGW mode, however, doesn't take the dllexport attribute into account in
any of the variants, and never produces export directives for the template
instantiation.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs