diff options
author | Steve Naroff <snaroff@apple.com> | 2007-09-03 01:24:23 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2007-09-03 01:24:23 +0000 |
commit | 7d2c5ed92e6cd78c5b19f3e3a5dc41ce046bf1e9 (patch) | |
tree | 4a1debdf2858154057ab4e8cfd1ae6d87fdacda0 /clang/test/Sema/array-init.c | |
parent | 50ab26e835b0070c9fef031ac4fb738e404fbd1a (diff) | |
download | bcm5719-llvm-7d2c5ed92e6cd78c5b19f3e3a5dc41ce046bf1e9.tar.gz bcm5719-llvm-7d2c5ed92e6cd78c5b19f3e3a5dc41ce046bf1e9.zip |
Finish getting "array-init.c" to work properly.
Array scalar initialization is now is reasonable shape.
Next step, structure and array of structure initializers.
llvm-svn: 41681
Diffstat (limited to 'clang/test/Sema/array-init.c')
-rw-r--r-- | clang/test/Sema/array-init.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/clang/test/Sema/array-init.c b/clang/test/Sema/array-init.c index 209b73463ad..20daa458384 100644 --- a/clang/test/Sema/array-init.c +++ b/clang/test/Sema/array-init.c @@ -7,16 +7,16 @@ 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}} -static int ary3[] = { 1, "abc", 3 }; // expected-warning{{incompatible types assigning 'char *' to 'int'}} +static int ary3[] = { 1, "abc", 3, 4 }; // expected-warning{{incompatible types assigning 'char *' to 'int'}} void func() { int x = 1; - //int x2[] = { 1, 3, 5 }; + int xComputeSize[] = { 1, 3, 5 }; int x3[x] = { 1, 2 }; // expected-error{{variable-sized object may not be initialized}} - int x4 = { 1, 2 }; // gcc-warning {{excess elements in array initializer}} + int x4 = { 1, 2 }; // // expected-warning{{excess elements in array initializer}} int y[4][3] = { { 1, 3, 5 }, @@ -28,6 +28,14 @@ void func() { 1, 3, 5, 2, 4, 6, 3, 5, 7 }; + int y3[4][3] = { + { 1, 3, 5 }, + { 2, 4, 6 }, + { 3, 5, 7 }, + { 4, 6, 8 }, + { 5 }, // expected-warning{{excess elements in array initializer}} + }; + struct threeElements { int a,b,c; } z = { 1 }; |