]> granicus.if.org Git - clang/commit
Don't assert on different DLL attributes in template and explicit instantiation ...
authorHans Wennborg <hans@hanshq.net>
Sun, 24 Aug 2014 00:12:36 +0000 (00:12 +0000)
committerHans Wennborg <hans@hanshq.net>
Sun, 24 Aug 2014 00:12:36 +0000 (00:12 +0000)
commit852eed5f0c761aa46f4e8dffb0432f81ab1dc9fa
tree1904cccef392d4d4e71f5d3926647e3eaa718624
parent707e27bb921177a401896074ac94ea0cc3b93017
Don't assert on different DLL attributes in template and explicit instantiation (PR20137)

We would previously assert (a decl cannot have two DLL attributes) on this code:

  template <typename T> struct __declspec(dllimport) S { T f() { return T(); } };
  template struct __declspec(dllexport) S<int>;

The problem was that when instantiating, we would take the attribute from the
template even if the instantiation itself already had an attribute.

Also, don't inherit DLL attributes from the template to its members before
instantiation, as the attribute may change.

I couldn't figure out what MinGW does here, so I'm leaving that open. At least
we're not asserting anymore.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216340 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaTemplateInstantiateDecl.cpp
test/CodeGenCXX/dllexport.cpp
test/CodeGenCXX/dllimport.cpp
test/SemaCXX/dllimport.cpp