From c0875507becfe14ad83acd50cceb66d1de641d1c Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Tue, 9 Jun 2015 00:39:05 +0000 Subject: MinGW: don't allow adding DLL attribute if template already has explicit instantiation declaration This is a follow-up to r238266 which failed to take MinGW into account. llvm-svn: 239374 --- clang/lib/Sema/SemaTemplate.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'clang/lib/Sema/SemaTemplate.cpp') diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 37eeee2f886..4fb7cb8f1dd 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -7369,7 +7369,11 @@ Sema::ActOnExplicitInstantiation(Scope *S, // FIXME: Need to notify the ASTMutationListener that we did this. Def->setTemplateSpecializationKind(TSK); - if (!getDLLAttr(Def) && getDLLAttr(Specialization)) { + if (!getDLLAttr(Def) && getDLLAttr(Specialization) && + Context.getTargetInfo().getCXXABI().isMicrosoft()) { + // In the MS ABI, an explicit instantiation definition can add a dll + // attribute to a template with a previous instantiation declaration. + // MinGW doesn't allow this. auto *A = cast( getDLLAttr(Specialization)->clone(getASTContext())); A->setInherited(true); -- cgit v1.2.3