diff options
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 }; |