summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/array-init.c
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2007-09-02 15:34:30 +0000
committerSteve Naroff <snaroff@apple.com>2007-09-02 15:34:30 +0000
commitf33527a1aaca63f72bfb644a65c43fe2f27c48cf (patch)
tree6b7e8718219c5040f0e0b87ba338c19a2ae04098 /clang/test/Sema/array-init.c
parent2fea13926f47a07b33dfd0dc8adf28151af9a938 (diff)
downloadbcm5719-llvm-f33527a1aaca63f72bfb644a65c43fe2f27c48cf.tar.gz
bcm5719-llvm-f33527a1aaca63f72bfb644a65c43fe2f27c48cf.zip
More semantic analysis of initializers.
Added 2 errors and one warning, updated test case. llvm-svn: 41672
Diffstat (limited to 'clang/test/Sema/array-init.c')
-rw-r--r--clang/test/Sema/array-init.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/Sema/array-init.c b/clang/test/Sema/array-init.c
index 2a26103a317..3ab2f4e5781 100644
--- a/clang/test/Sema/array-init.c
+++ b/clang/test/Sema/array-init.c
@@ -1,5 +1,12 @@
// RUN: clang -parse-ast-check -pedantic %s
+static int x, y, z;
+
+static int ary[] = { x, y, z }; // expected-error{{initializer element is not constant}}
+int ary2[] = { x, y, z }; // expected-error{{initializer element is not constant}}
+
+extern int fileScopeExtern[3] = { 1, 3, 5 }; // expected-warning{{'extern' variable has an initializer}}
+
void func() {
int x = 1;
@@ -24,4 +31,6 @@ void func() {
} z = { 1 };
struct threeElements *p = 7; // expected-warning{{incompatible types assigning 'int' to 'struct threeElements *'}}
+
+ extern int blockScopeExtern[3] = { 1, 3, 5 }; // expected-error{{'extern' variable cannot have an initializer}}
}
OpenPOWER on IntegriCloud