Anders Carlsson | 6a24acb | 2008-02-16 01:20:23 +0000 | [diff] [blame^] | 1 | // RUN: clang %s -fsyntax-only -verify |
| 2 | |
| 3 | struct s { |
| 4 | char a; |
| 5 | int b __attribute__((packed)); |
| 6 | char c; |
| 7 | int d; |
| 8 | }; |
| 9 | |
| 10 | struct __attribute__((packed)) packed_s { |
| 11 | char a; |
| 12 | int b __attribute__((packed)); |
| 13 | char c; |
| 14 | int d; |
| 15 | }; |
| 16 | |
| 17 | struct fas { |
| 18 | char a; |
| 19 | int b[]; |
| 20 | }; |
| 21 | |
| 22 | struct __attribute__((packed)) packed_fas { |
| 23 | char a; |
| 24 | int b[]; |
| 25 | }; |
| 26 | |
| 27 | extern int a1[sizeof(struct s) == 12 ? 1 : -1]; |
| 28 | extern int a2[__alignof(struct s) == 4 ? 1 : -1]; |
| 29 | |
| 30 | extern int b1[sizeof(struct packed_s) == 10 ? 1 : -1]; |
| 31 | extern int b2[__alignof(struct packed_s) == 1 ? 1 : -1]; |
| 32 | |
| 33 | extern int c1[sizeof(struct fas) == 4 ? 1 : -1]; |
| 34 | extern int c2[__alignof(struct fas) == 4 ? 1 : -1]; |
| 35 | |
| 36 | extern int d1[sizeof(struct packed_fas) == 1 ? 1 : -1]; |
| 37 | extern int d2[__alignof(struct packed_fas) == 1 ? 1 : -1]; |