aboutsummaryrefslogtreecommitdiff
path: root/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
commit6f9f307d527e3451470dd07ae932475f26c6de6e (patch)
treeedb1a32688a2aeff4ca556e64718a1d1395bcba2 /test/Sema/array-init.c
parentf009063ab7e05be7781751ff9e4b42630f07a747 (diff)
More semantic analysis of initializers.
Added 2 errors and one warning, updated test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41672 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/array-init.c')
-rw-r--r--test/Sema/array-init.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/Sema/array-init.c b/test/Sema/array-init.c
index 2a26103a31..3ab2f4e578 100644
--- a/test/Sema/array-init.c
+++ b/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}}
}