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 | d35005ece906cca5238d75b031b8db7eac0ac6e1 (patch) | |
tree | 69db98951043dda597f0b4e8ed291e84bdfd16b7 /test/Sema/array-init.c | |
parent | 38374b05791ee93300b9fbe8ceb3957f54184b37 (diff) |
Finish getting "array-init.c" to work properly.
Array scalar initialization is now is reasonable shape.
Next step, structure and array of structure initializers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41681 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/array-init.c')
-rw-r--r-- | test/Sema/array-init.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/test/Sema/array-init.c b/test/Sema/array-init.c index 209b73463a..20daa45838 100644 --- a/test/Sema/array-init.c +++ b/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 }; |