Open zahiraam opened 7 years ago
I think the issue is that we should treat explicit instantiations with dllimport as explicit instantiation declarations. Do we not already do that? For example, if I modify the original program like this, clang doesn't reject:
struct I; template
struct X { void f(T p) { p->i(); } }; extern template void X::f(I); I seem to remember that dllimport and dllexport have some of the effects of the 'extern' keyword.
Oh right, yes that was r270897. Sounds like we need to expand that.
I'll put this on my TODO list, but patches are also welcome :-)
I think the issue is that we should treat explicit instantiations with dllimport
as explicit instantiation declarations. Do we not already do that? For example, if I modify the original program like this, clang doesn't reject:
struct I;
template<typename T> struct X {
void f(T *p) { p->i(); }
};
extern template void X<I>::f(I*);
I seem to remember that dllimport
and dllexport
have some of the effects of the extern
keyword.
But can the user fix their code, or is this happening e.g. in a sytem header?
Clang doesn't promise to be bug-for-bug compatible with MSVC, and in this case I'm not sure what Clang is doing is wrong.
Yes this happens in user code that we don't have control over.
Is this occurring in code that cannot be fixed?
Clang's behaviour seems reasonable here.
Is the void f(); // f is now overloaded
line significant?
Extended Description