aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp2
-rw-r--r--test/SemaTemplate/instantiate-static-var.cpp23
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 292820b821..549f87b2ca 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -233,7 +233,7 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) {
bool Redeclaration = false;
// FIXME: having to fake up a LookupResult is dumb.
LookupResult Previous(SemaRef, Var->getDeclName(), Var->getLocation(),
- Sema::LookupOrdinaryName);
+ Sema::LookupOrdinaryName, Sema::ForRedeclaration);
if (D->isStaticDataMember())
SemaRef.LookupQualifiedName(Previous, Owner, false);
SemaRef.CheckVariableDeclaration(Var, Previous, Redeclaration);
diff --git a/test/SemaTemplate/instantiate-static-var.cpp b/test/SemaTemplate/instantiate-static-var.cpp
index 789fe3db87..fda2b9ea30 100644
--- a/test/SemaTemplate/instantiate-static-var.cpp
+++ b/test/SemaTemplate/instantiate-static-var.cpp
@@ -92,3 +92,26 @@ struct SizeOf {
void MyTest3() {
Y3().Foo(X3<SizeOf<char>::value>());
}
+
+namespace PR6449 {
+ template<typename T>
+ struct X0 {
+ static const bool var = false;
+ };
+
+ template<typename T>
+ const bool X0<T>::var;
+
+ template<typename T>
+ struct X1 : public X0<T> {
+ static const bool var = false;
+ };
+
+ template<typename T>
+ const bool X1<T>::var;
+
+ template class X0<char>;
+ template class X1<char>;
+
+}
+