When looking for a redeclaration of a static variable, only look for redeclarations. Fixes PR6449

llvm-svn: 97478
This commit is contained in:
Douglas Gregor 2010-03-01 19:11:54 +00:00
parent d8425df136
commit 79e31db9a9
2 changed files with 24 additions and 1 deletions

View File

@ -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);

View File

@ -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>;
}