Steve Naroff | f009063 | 2007-09-02 02:04:30 +0000 | [diff] [blame^] | 1 | // RUN: clang -parse-ast-check -pedantic %s |
| 2 | |
| 3 | void func() { |
| 4 | int x = 1; |
| 5 | |
| 6 | //int x2[] = { 1, 3, 5 }; |
| 7 | |
| 8 | int x3[x] = { 1, 2 }; // gcc-error {{variable-sized object may not be initialized}} |
| 9 | |
| 10 | int x4 = { 1, 2 }; // gcc-warning {{excess elements in array initializer}} |
| 11 | |
| 12 | int y[4][3] = { |
| 13 | { 1, 3, 5 }, |
| 14 | { 2, 4, 6 }, |
| 15 | { 3, 5, 7 }, |
| 16 | }; |
| 17 | |
| 18 | int y2[4][3] = { |
| 19 | 1, 3, 5, 2, 4, 6, 3, 5, 7 |
| 20 | }; |
| 21 | |
| 22 | struct threeElements { |
| 23 | int a,b,c; |
| 24 | } z = { 1 }; |
| 25 | |
| 26 | struct threeElements *p = 7; // expected-warning{{incompatible types assigning 'int' to 'struct threeElements *'}} |
| 27 | } |