summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/tentative-decls.c
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-08-08 17:50:35 +0000
committerSteve Naroff <snaroff@apple.com>2008-08-08 17:50:35 +0000
commit5bb8f2264b95a4792bd87f2e024e85827c3b1f1d (patch)
treedecb019d463f5bbed917d496f3e3908b874cd1ba /clang/test/Sema/tentative-decls.c
parent37088116e792d4ac7772fc48a711756713d7c6ce (diff)
downloadbcm5719-llvm-5bb8f2264b95a4792bd87f2e024e85827c3b1f1d.tar.gz
bcm5719-llvm-5bb8f2264b95a4792bd87f2e024e85827c3b1f1d.zip
Fix issues with C "tentative" definitions.
- Move checking from MergeVarDecl->FinializeDeclaratorGroup. Since MergeVarDecl is called before the initializer is attacted, it can't be done there (this removes a long standing FIXME). - Add Sema::isTentativeDefinition() and Sema::CheckForFileScopedRedefinitions(). - Remove FIXME's and touch-up test case. Still some more work to do (forthcoming)... llvm-svn: 54533
Diffstat (limited to 'clang/test/Sema/tentative-decls.c')
-rw-r--r--clang/test/Sema/tentative-decls.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/test/Sema/tentative-decls.c b/clang/test/Sema/tentative-decls.c
index 6e79a0868fd..64f3809e19f 100644
--- a/clang/test/Sema/tentative-decls.c
+++ b/clang/test/Sema/tentative-decls.c
@@ -11,16 +11,19 @@ const int c[];
int i1 = 1; // expected-error{{previous definition is here}}
int i1 = 2; // expected-error{{redefinition of 'i1'}} // expected-error{{previous definition is here}}
-// FIXME: the following should not be an error (see related FIXME in Sema::MergeVarDecl).
-int i1; // expected-error{{redefinition of 'i1'}}
+int i1;
int i1;
extern int i1; // expected-error{{previous definition is here}}
static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}} expected-error{{previous definition is here}}
-int i1 = 3; // expected-error{{non-static declaration of 'i1' follows static declaration}}
+int i1 = 3; // expected-error{{redefinition of 'i1'}} expected-error{{non-static declaration of 'i1' follows static declaration}}
__private_extern__ int pExtern;
int pExtern = 0;
+int i4;
+int i4;
+extern int i4;
+
void func() {
extern int i1; // expected-error{{previous definition is here}}
static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}}
OpenPOWER on IntegriCloud