aboutsummaryrefslogtreecommitdiff
path: root/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
commitff9eb1fe0a16a34c355db0d1bc4a9d0f7a276c73 (patch)
tree136a9962ea9a73b40fdaca3776ce52afba806f37 /test/Sema/tentative-decls.c
parent296e8671bca0d1d54c0755ba3fc1c7b285924fe6 (diff)
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)... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54533 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/tentative-decls.c')
-rw-r--r--test/Sema/tentative-decls.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/Sema/tentative-decls.c b/test/Sema/tentative-decls.c
index 6e79a0868f..64f3809e19 100644
--- a/test/Sema/tentative-decls.c
+++ b/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}}