Fixes a regression when redeclaration of a global satic

is an extern local to a function. Radar 8125274.

llvm-svn: 106773
This commit is contained in:
Fariborz Jahanian 2010-06-24 18:50:41 +00:00
parent 3f0e992af1
commit 4f9c9d6591
2 changed files with 11 additions and 1 deletions

View File

@ -1456,7 +1456,8 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) {
}
if (New->hasExternalStorage() &&
Old->getLinkage() == InternalLinkage)
Old->getLinkage() == InternalLinkage &&
New->getDeclContext() == Old->getDeclContext())
New->setStorageClass(Old->getStorageClass());
// Keep a chain of previous declarations.

View File

@ -0,0 +1,9 @@
// RUN: %clang_cc1 -fsyntax-only %s
// rdar: // 8125274
static int a16[]; // expected-warning {{tentative array definition assumed to have one element}}
void f16(void) {
extern int a16[];
}