1 // XFAIL: target-windows
2 // RUN: %clangxx_host -gdwarf -o %t %s
4 // RUN: -o "expr alignof(packed)" \
5 // RUN: -o "expr sizeof(packed)" \
6 // RUN: -o "expr alignof(packed_and_aligned)" \
7 // RUN: -o "expr sizeof(packed_and_aligned)" \
8 // RUN: -o "expr alignof(derived)" \
9 // RUN: -o "expr sizeof(derived)" \
10 // RUN: -o exit | FileCheck %s
12 struct __attribute__((packed
)) packed
{
17 static_assert(alignof(packed
) == 1);
18 static_assert(sizeof(packed
) == 9);
20 // CHECK: (lldb) expr alignof(packed)
21 // CHECK-NEXT: ${{.*}} = 1
22 // CHECK: (lldb) expr sizeof(packed)
23 // CHECK-NEXT: ${{.*}} = 9
25 struct __attribute__((packed
, aligned(16))) packed_and_aligned
{
29 } g_packed_and_aligned_struct
;
30 static_assert(alignof(packed_and_aligned
) == 16);
31 static_assert(sizeof(packed_and_aligned
) == 16);
33 // CHECK: (lldb) expr alignof(packed_and_aligned)
34 // CHECK-NEXT: ${{.*}} = 16
35 // CHECK: (lldb) expr sizeof(packed_and_aligned)
36 // CHECK-NEXT: ${{.*}} = 16
38 struct __attribute__((packed
)) packed_base
{ int x
; };
39 static_assert(alignof(packed_base
) == 1);
41 struct derived
: packed
, packed_base
{} g_derived
;
42 static_assert(alignof(derived
) == 1);
43 static_assert(sizeof(derived
) == 13);
45 // CHECK: (lldb) expr alignof(derived)
46 // CHECK-NEXT: ${{.*}} = 1
47 // CHECK: (lldb) expr sizeof(derived)
48 // CHECK-NEXT: ${{.*}} = 13