Allow definition of dllimport static fields in partial specializations (PR19956)
This expands the logic from r210141 to cover partial specializations too.
llvm-svn: 210484
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index ec0c27b..09fcf1c 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -9111,9 +9111,11 @@
VD->isThisDeclarationADefinition()) {
// We allow definitions of dllimport class template static data members
// with a warning.
+ CXXRecordDecl *Context =
+ cast<CXXRecordDecl>(VD->getFirstDecl()->getDeclContext());
bool IsClassTemplateMember =
- cast<CXXRecordDecl>(VD->getFirstDecl()->getDeclContext())
- ->getDescribedClassTemplate();
+ isa<ClassTemplatePartialSpecializationDecl>(Context) ||
+ Context->getDescribedClassTemplate();
Diag(VD->getLocation(),
IsClassTemplateMember