[cfe-commits] r67530 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Sema/tentative-decls.c

Douglas Gregor dgregor at apple.com
Mon Mar 23 09:17:01 PDT 2009


Author: dgregor
Date: Mon Mar 23 11:17:01 2009
New Revision: 67530

URL: http://llvm.org/viewvc/llvm-project?rev=67530&view=rev
Log:
Thanks to Eli for pointing out my misreading of 6.2.2p5

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=67530&r1=67529&r2=67530&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Mar 23 11:17:01 2009
@@ -841,8 +841,7 @@
   //   the prior declaration. If no prior declaration is visible, or
   //   if the prior declaration specifies no linkage, then the
   //   identifier has external linkage.
-  if ((New->hasExternalStorage() || New->getStorageClass() == VarDecl::None) &&
-      Old->hasLinkage())
+  if (New->hasExternalStorage() && Old->hasLinkage())
     /* Okay */;
   else if (New->getStorageClass() != VarDecl::Static &&
            Old->getStorageClass() == VarDecl::Static) {

Modified: cfe/trunk/test/Sema/tentative-decls.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/tentative-decls.c?rev=67530&r1=67529&r2=67530&view=diff

==============================================================================
--- cfe/trunk/test/Sema/tentative-decls.c (original)
+++ cfe/trunk/test/Sema/tentative-decls.c Mon Mar 23 11:17:01 2009
@@ -27,7 +27,10 @@
 static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}}
 
 static int i2 = 5; // expected-note 1 {{previous definition is here}}
-int i2 = 3; // expected-error{{redefinition of 'i2'}}
+int i2 = 3; // expected-error{{non-static declaration of 'i2' follows static declaration}}
+
+static int i3 = 5;
+extern int i3;
 
 __private_extern__ int pExtern;
 int pExtern = 0;





More information about the cfe-commits mailing list