1 // REQUIRES: aarch64-registered-target
2 // RUN: %clang_cc1 -triple aarch64-linux-gnu -x c++ -std=c++1z %s -verify
3 // expected-no-diagnostics
14 static_assert(offsetof(struct t1
, bar
) == 1);
15 static_assert(sizeof(struct t1
) == 4);
23 static_assert(offsetof(struct t2
, bar
) == 2);
24 static_assert(sizeof(struct t2
) == 4);
32 static_assert(offsetof(struct t3
, bar
) == 4);
33 static_assert(sizeof(struct t3
) == 8);
41 static_assert(offsetof(struct t4
, bar
) == 8);
42 static_assert(sizeof(struct t4
) == 16);
50 static_assert(offsetof(struct t5
, bar
) == 8);
51 static_assert(sizeof(struct t5
) == 16);
60 static_assert(offsetof(struct t6
, bar2
) == 2);
61 static_assert(sizeof(struct t6
) == 4);
70 static_assert(offsetof(struct t7
, bar2
) == 3);
71 static_assert(sizeof(struct t7
) == 4);
80 static_assert(offsetof(struct t8
, bar2
) == 5);
81 static_assert(sizeof(struct t8
) == 8);
90 static_assert(offsetof(struct t9
, bar2
) == 9);
91 static_assert(sizeof(struct t9
) == 16);
100 static_assert(offsetof(struct t10
, bar2
) == 9);
101 static_assert(sizeof(struct t10
) == 16);
111 static_assert(offsetof(struct t11
, bar2
) == 9);
112 static_assert(sizeof(struct t11
) == 16);
122 static_assert(offsetof(struct t12
, bar
) == 8);
123 static_assert(sizeof(struct t12
) == 16);
131 static_assert(offsetof(struct t13
, bar
) == 8);
132 static_assert(sizeof(struct t13
) == 16);
146 static_assert(offsetof(struct t14
, bar1
) == 10);
147 static_assert(offsetof(struct t14
, bar2
) == 12);
148 static_assert(sizeof(struct t14
) == 16);
159 static_assert(offsetof(struct t15
, bar
) == 4);
160 static_assert(sizeof(struct t15
) == 8);
167 static_assert(offsetof(struct t16
, bar
) == 0);
168 static_assert(sizeof(struct t16
) == 8);
178 static_assert(offsetof(struct t17
, bar
) == 8);
179 static_assert(sizeof(struct t17
) == 16);
187 static_assert(sizeof(struct t18
) == 8);
197 static_assert(offsetof(struct t19
, bar
) == 6);
198 static_assert(sizeof(struct t19
) == 8);
207 static_assert(offsetof(struct t20
, bar
) == 8);
208 static_assert(sizeof(struct t20
) == 16);
230 static_assert(offsetof(struct t21
, bar1
) == 8);
231 static_assert(offsetof(struct t21
, bar2
) == 12);
232 static_assert(offsetof(struct t21
, bar3
) == 16);
233 static_assert(offsetof(struct t21
, bar4
) == 40);
234 static_assert(sizeof(struct t21
) == 56);
236 // The rules also apply to anonymous bitfields with non-zero length.
243 static_assert(alignof(struct t22
) == 2);
244 static_assert(offsetof(struct t22
, bar
) == 2);