summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaDecl.cpp3
-rw-r--r--clang/test/CodeGenCXX/dllimport.cpp2
2 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 5276cafcf72..44ca495cb15 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -9766,7 +9766,8 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D) {
ResolveExceptionSpec(D->getLocation(), FPT);
// dllimport cannot be applied to non-inline function definitions.
- if (FD->hasAttr<DLLImportAttr>() && !FD->isInlined()) {
+ if (FD->hasAttr<DLLImportAttr>() && !FD->isInlined() &&
+ !FD->isTemplateInstantiation()) {
assert(!FD->hasAttr<DLLExportAttr>());
Diag(FD->getLocation(), diag::err_attribute_dllimport_function_definition);
FD->setInvalidDecl();
diff --git a/clang/test/CodeGenCXX/dllimport.cpp b/clang/test/CodeGenCXX/dllimport.cpp
index d8e58f71903..c4640c1af5d 100644
--- a/clang/test/CodeGenCXX/dllimport.cpp
+++ b/clang/test/CodeGenCXX/dllimport.cpp
@@ -8,7 +8,7 @@ void DLLIMPORT a();
inline void DLLIMPORT b() {}
// CHECK-DAG: define available_externally dllimport void @"\01?b@@YAXXZ"()
-template <typename T> inline void c() {} // FIXME: MSVC accepts this without 'inline' too.
+template <typename T> void c() {}
template void DLLIMPORT c<int>();
// CHECK-DAG: define available_externally dllimport void @"\01??$c@H@@YAXXZ"()
OpenPOWER on IntegriCloud