[cfe-commits] r56280 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Sema/tentative-decls.c
Steve Naroff
snaroff at apple.com
Wed Sep 17 07:05:47 PDT 2008
Author: snaroff
Date: Wed Sep 17 09:05:40 2008
New Revision: 56280
URL: http://llvm.org/viewvc/llvm-project?rev=56280&view=rev
Log:
Fix http://llvm.org/bugs/show_bug.cgi?id=2760.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Sema/tentative-decls.c
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=56280&r1=56279&r2=56280&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Sep 17 09:05:40 2008
@@ -464,8 +464,8 @@
Diag(Old->getLocation(), diag::err_previous_definition);
return New;
}
- // File scoped variables are analyzed in FinalizeDeclaratorGroup.
- if (!New->isFileVarDecl()) {
+ // Variables with external linkage are analyzed in FinalizeDeclaratorGroup.
+ if (New->getStorageClass() != VarDecl::Extern && !New->isFileVarDecl()) {
Diag(New->getLocation(), diag::err_redefinition, New->getName());
Diag(Old->getLocation(), diag::err_previous_definition);
}
Modified: cfe/trunk/test/Sema/tentative-decls.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/tentative-decls.c?rev=56280&r1=56279&r2=56280&view=diff
==============================================================================
--- cfe/trunk/test/Sema/tentative-decls.c (original)
+++ cfe/trunk/test/Sema/tentative-decls.c Wed Sep 17 09:05:40 2008
@@ -35,3 +35,9 @@
extern int i1; // expected-error{{previous definition is here}}
static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}}
}
+
+void func2(void)
+{
+ extern double *p;
+ extern double *p;
+}
More information about the cfe-commits
mailing list