[C++20] [Modules] Fix may-be incorrect ADL for module local entities (#123931)
[llvm-project.git] / lldb / test / Shell / SymbolFile / DWARF / packed-alignof.cpp
blobdcc02736a9be74b3d9f04bd0c144440be073f38a
1 // XFAIL: *
2 //
3 // RUN: %clangxx_host -gdwarf -o %t %s
4 // RUN: %lldb %t \
5 // RUN: -o "expr alignof(base)" \
6 // RUN: -o "expr alignof(packed_base)" \
7 // RUN: -o "expr alignof(derived)" \
8 // RUN: -o "expr sizeof(derived)" \
9 // RUN: -o exit | FileCheck %s
11 struct __attribute__((packed)) packed {
12 int x;
13 char y;
14 int z;
15 } g_packed_struct;
17 // LLDB incorrectly calculates alignof(base)
18 struct foo {};
19 struct base : foo { int x; };
20 static_assert(alignof(base) == 4);
22 // CHECK: (lldb) expr alignof(base)
23 // CHECK-NEXT: ${{.*}} = 4
25 // LLDB incorrectly calculates alignof(packed_base)
26 struct __attribute__((packed)) packed_base { int x; };
27 static_assert(alignof(packed_base) == 1);
29 // CHECK: (lldb) expr alignof(packed_base)
30 // CHECK-NEXT: ${{.*}} = 1
32 struct derived : packed, packed_base {
33 short s;
34 } g_derived;
35 static_assert(alignof(derived) == 2);
36 static_assert(sizeof(derived) == 16);
38 // CHECK: (lldb) expr alignof(derived)
39 // CHECK-NEXT: ${{.*}} = 2
40 // CHECK: (lldb) expr sizeof(derived)
41 // CHECK-NEXT: ${{.*}} = 16
43 int main() {}