diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
commit | be1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch) | |
tree | 1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/Sema/tentative-decls.c | |
parent | c4626a62754862d20b41e8a46a3574264ea80e6d (diff) | |
parent | f1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff) |
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/Sema/tentative-decls.c')
-rw-r--r-- | clang/test/Sema/tentative-decls.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/clang/test/Sema/tentative-decls.c b/clang/test/Sema/tentative-decls.c new file mode 100644 index 0000000..b15537b --- /dev/null +++ b/clang/test/Sema/tentative-decls.c @@ -0,0 +1,65 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify + +// PR3310 +struct a x1; // expected-note 2{{forward declaration of 'struct a'}} +static struct a x2; // expected-warning{{tentative definition of variable with internal linkage has incomplete non-array type 'struct a'}} +struct a x3[10]; // expected-error{{array has incomplete element type 'struct a'}} +struct a {int x;}; +static struct a x2_okay; +struct a x3_okay[10]; +struct b x4; // expected-error{{tentative definition has type 'struct b' that is never completed}} \ + // expected-note{{forward declaration of 'struct b'}} + +const int a [1] = {1}; +extern const int a[]; + +extern const int b[]; +const int b [1] = {1}; + +extern const int c[] = {1}; // expected-warning{{'extern' variable has an initializer}} +const int c[]; + +int i1 = 1; // expected-note {{previous definition is here}} +int i1 = 2; // expected-error {{redefinition of 'i1'}} +int i1; +int i1; +extern int i5; // expected-note {{previous definition is here}} +static int i5; // expected-error{{static declaration of 'i5' follows non-static declaration}} + +static int i2 = 5; // expected-note 1 {{previous definition is here}} +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; + +int i4; +int i4; +extern int i4; + +int (*pToArray)[]; +int (*pToArray)[8]; + +int redef[10]; +int redef[]; // expected-note {{previous definition is here}} +int redef[11]; // expected-error{{redefinition of 'redef'}} + +void func() { + extern int i6; // expected-note {{previous definition is here}} + static int i6; // expected-error{{static declaration of 'i6' follows non-static declaration}} +} + +void func2(void) +{ + extern double *p; + extern double *p; +} + +// <rdar://problem/6808352> +static int a0[]; +static int b0; + +static int a0[] = { 4 }; +static int b0 = 5; |