summaryrefslogtreecommitdiff
path: root/lldb/test/Shell/SymbolFile/DWARF/x86/no_unique_address-base-alignment.cpp
blob: c4bcfc473277f6938bc4149fecd576fb204bdc27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// XFAIL: *

// RUN: %clang --target=x86_64-apple-macosx -c -gdwarf -o %t %s
// RUN: %lldb %t \
// RUN:   -o "expr alignof(OverlappingDerived)" \
// RUN:   -o "expr sizeof(OverlappingDerived)" \
// RUN:   -o exit | FileCheck %s

struct Empty {};

struct OverlappingBase {
  [[no_unique_address]] Empty e;
};
static_assert(sizeof(OverlappingBase) == 1);
static_assert(alignof(OverlappingBase) == 1);

struct Base {
  int mem;
};

struct OverlappingDerived : Base, OverlappingBase {};
static_assert(alignof(OverlappingDerived) == 4);
static_assert(sizeof(OverlappingDerived) == 4);

// CHECK:      (lldb) expr alignof(OverlappingDerived)
// CHECK-NEXT: ${{.*}} = 4
// CHECK:      (lldb) expr sizeof(OverlappingDerived)
// CHECK-NEXT: ${{.*}} = 4

int main() { OverlappingDerived d; }